CentOS使用yum源中自帶的rpm包安裝LAMP環(huán)境。這是linux下安裝LAMP的環(huán)境一種最基本最簡便的方式。新手可以從容安裝使用。1. 安裝基礎包(可選安裝)yum install -y wget zip unzip gzipyum install -y python ruby perlyum install -y gc gcc gcc-c++2. 安裝php及其相關組件yum install -y php php-gdyum install -y php-mbstring php-mcrypt php-MySQL php-pdo3. 啟動httpd服務器service httpd startchkconfig httpd on 設置開機自動啟動服務器www目錄地址/var/www/html/4. 安裝mysqlyum install -y mysql mysql-server[root@localhost html]# service mysqld start5. 配置mysql根據(jù)提示運行/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.zipunzip 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/ 就可以根據(jù) 5. 配置mysql 中設置的root密碼登錄7. 防火墻問題購買的服務器一般鏡像安裝后都會默認開啟22,80等常用端口。自己安裝centos到特定機器或vmware虛擬機安裝的時候可能出現(xiàn)iptables沒有配置導致80端口無法訪問的問題。臨時禁用iptables的方法(重啟機器后失效),使用命令 service iptables stop千萬不要在生產(chǎn)環(huán)境中這么做!---------------------------------------------------初次運行 service mysqld start 會有下面的提示,此處做好記錄以備以后查看,對數(shù)據(jù)庫問題修復有至關重要的作用!!Initializing MySQL database: Installing MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE 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_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly 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.plcd /usr/mysql-test ; perl mysql-test-run.plPlease report any problems with the /usr/bin/mysqlbug script![ OK ]Starting mysqld: [ OK ]
新聞熱點
疑難解答
圖片精選