您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關(guān)CentOS LAMP配置是怎樣的,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
今天用yum方法搭建起了個(gè)CentOS LAMP環(huán)境,中間遇到了很多問(wèn)題,經(jīng)過(guò)google和各位前輩的幫助,終于將環(huán)境搭建起來(lái),現(xiàn)在把完整的步驟記錄下來(lái):
一、換源,sohu的相當(dāng)好用。
備份CentOS-Base.repo
view sourceprint?cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
替換源
用vi打開(kāi)CentOS-Base.repo,并將內(nèi)容清空,然后將下面的內(nèi)容復(fù)制進(jìn)去,并保存。
view sourceprint?# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.sohu.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.sohu.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
baseurl=http://mirrors.sohu.com/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.sohu.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.sohu.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
二、更新一下系統(tǒng)
view sourceprint?#yum -y update
三、安裝Apache
view sourceprint?#yum install httpd
安裝完成后,用
view sourceprint?/etc/init.d/httpd start
啟動(dòng)apache
設(shè)為開(kāi)機(jī)啟動(dòng)
view sourceprint?#chkconfig httpd on
四、安裝MYSQL
view sourceprint?#yum install mysql mysql-server
同樣,完成后,用
view sourceprint?/etc/init.d/mysqld start
啟動(dòng)mysql
設(shè)置MYSQL密碼
view sourceprint?#/usr/bin/mysqladmin -u root -h localhost password '新密碼'
#mysql -u root –p #進(jìn)入MYSQL,
#Enter Password:
更新MYSQL密碼
view sourceprint?mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql> FLUSH PRIVILEGES;
允許遠(yuǎn)程登錄
view sourceprint?mysql>GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
完成后就能用mysql-front遠(yuǎn)程管理mysql了。
讓MYSQL數(shù)據(jù)庫(kù)更安全
view sourceprint?mysql -u root -p [此時(shí)會(huì)要求你輸入剛剛設(shè)置的密碼,輸入后回車(chē)即可
mysql> DROP DATABASE test; [刪除test數(shù)據(jù)庫(kù)]
mysql> DELETE FROM mysql.user WHERE user =’’; [刪除匿名帳戶(hù)]
mysql> FLUSH PRIVILEGES; [重載權(quán)限]
mysql> exit; [退出MYSQL]
設(shè)為開(kāi)機(jī)啟動(dòng)
view sourceprint?#chkconfig mysqld on
五、安裝PHP
view sourceprint?#yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml libmcrypt
view sourceprint?#/etc/init.d/httpd start [運(yùn)行HTTPD]
六、測(cè)試一下
在/var/www/html/新建個(gè)test.php文件,將以下內(nèi)容寫(xiě)入,然后保存。
view sourceprint?
phpinfo();
?>
然后在客戶(hù)端瀏覽器里打開(kāi)http://IP/test.php,若能成功顯示,則表示安裝成功。
至此,安裝完畢。
看完上述內(nèi)容,你們對(duì)CentOS LAMP配置是怎樣的有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注億速云行業(yè)資訊頻道,感謝大家的支持。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。