CentOS使用yum源中內建的rpm包安裝LAMP環境

來源:互聯網
上載者:User

標籤:

CentOS使用yum源中內建的rpm包安裝LAMP環境。這是Linux下安裝LAMP的環境一種最基本最簡便的方式。新手可以從容安裝使用。

1. 安裝基礎包(可選安裝)
yum install -y wget zip unzip gzip
yum install -y python ruby perl
yum install -y gc gcc gcc-c++

2. 安裝php及其相關組件
yum install -y php php-gd
yum install -y php-mbstring php-mcrypt php-mysql php-pdo

3. 啟動httpd伺服器
service httpd start
chkconfig httpd on 設定開機自動啟動
伺服器www目錄位址/var/www/html/

4. 安裝mysql
yum install -y mysql mysql-server
[[email protected] html]# service mysqld start

5. 配置mysql
根據提示運行
/usr/bin/mysql_secure_installation
按照提示對mysql進行配置,包括root密碼設定等等。
chkconfig mysqld on 設定開機自動啟動

6. 安裝phpmyadmin
下載phpmyadmin相應版本 https://www.phpmyadmin.net/files/
將zip包copy到/var/www/html/目錄,並解壓縮重新命名為phpmyadmin
例如:
wget https://files.phpmyadmin.net/phpMyAdmin/3.5.8.2/phpMyAdmin-3.5.8.2-all-languages.zip
unzip phpMyAdmin-3.5.8.2-all-languages.zip -d /var/www/html/
mv /var/www/html/phpMyAdmin-3.5.8.2-all-languages /var/www/html/phpmyadmin
訪問 http://youripaddress/phpmyadmin/ 就可以根據 5. 配置mysql 中設定的root密碼登入

7. 防火牆問題
購買的伺服器一般鏡像安裝後都會預設開啟22,80等常用連接埠。
自己安裝centos到特定機器或vmware虛擬機器安裝的時候可能出現iptables沒有配置導致80連接埠無法訪問的問題。
臨時禁用iptables的方法(重啟機器後失效),使用命令 service iptables stop
千萬不要在生產環境中這麼做!

---------------------------------------------------
初次運行 service mysqld start 會有下面的提示,此處做好記錄以備以後查看,
對資料庫問題修複有至關重要的作用!!
Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password ‘new-password‘
/usr/bin/mysqladmin -u root -h localhost.localdomain password ‘new-password‘

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

[  OK  ]
Starting mysqld:  [  OK  ]




CentOS使用yum源中內建的rpm包安裝LAMP環境

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.