使用yum安裝LAMP的方法
使用yum安裝LAMP的方法:
1、yum update 檢查一下系統(tǒng)更新 初次安裝可能更新的時(shí)間會(huì)比較長(zhǎng),請(qǐng)耐心等待。
2、yum install gcc gcc-c++ ;安裝gcc軟件編譯環(huán)境。
3、yum erase httpd ;卸載系統(tǒng)自帶的httpd (apache2.2.3)
4、yum install zlib-devel libtool ncurses-devel libxml2-devel
(zlib-devel 安裝apache需要,否則出錯(cuò) .libtool安裝mysql時(shí)候需要.同時(shí)附帶了autoconf automake imake 編譯mysql 5.1.48時(shí)候會(huì)出錯(cuò) 需要autoconf重新配置一下)
以上為一些準(zhǔn)備工作,使用yum安裝LAMP的前提準(zhǔn)備。接下開(kāi)始安裝各個(gè)組件。
apache
- yum install httpd httpd-devel
安裝好之后啟動(dòng)apache:/etc/init.d/httpd start
mysql
- yum install mysql msql-sever mysql-devel
啟動(dòng)mysql服務(wù):/etc/init.d/mysqld start
設(shè)置mysql密碼:
直接使用"mysql"進(jìn)入數(shù)據(jù)庫(kù)模式,
- mysql> USE mysql;
- mysql> UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
- mysql> FLUSH PRIVILEGES;
登陸
mysql -u root -p
Enter Password:
創(chuàng)建一個(gè)用戶管理數(shù)據(jù)庫(kù)
- mysql > create database demo
- mysql >GRANT ALL PRIVILEGES ON demo.* TO 'guest'@'localhost' IDENTIFIED BY 'guest' WITH GRANT OPTION;
- mysql> UPDATE user SET Password=PASSWORD('guest') WHERE user='guest';
php
- yum install php php-mysql php-common php-gd php-mbstring php-mcrtpt php-devel php-xml
安裝好php之后重啟httpd : /etc/init.d/httpd restart
設(shè)置成開(kāi)機(jī)啟動(dòng):
- chkconfig httpd on
- chkconfig mysqld on
最后需要安裝squid組件
- yum -y install squid
【編輯推薦】