今天就跟大家聊聊有關CentOS LAMP配置是怎樣的,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。
成都創新互聯公司主營海州網站建設的網絡公司,主營網站建設方案,重慶APP軟件開發,海州h5小程序開發搭建,海州網站營銷推廣歡迎海州等地區企業咨詢
今天用yum方法搭建起了個CentOSLAMP環境,中間遇到了很多問題,經過google和各位前輩的幫助,終于將環境搭建起來,現在把完整的步驟記錄下來:
一、換源,sohu的相當好用。
備份CentOS-Base.repo
view sourceprint?cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
替換源
用vi打開CentOS-Base.repo,并將內容清空,然后將下面的內容復制進去,并保存。
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
二、更新一下系統
view sourceprint?#yum -y update
三、安裝Apache
view sourceprint?#yum install httpd
安裝完成后,用
view sourceprint?/etc/init.d/httpd start
啟動apache
設為開機啟動
view sourceprint?#chkconfig httpd on
四、安裝MySQL
view sourceprint?#yum install mysql mysql-server
同樣,完成后,用
view sourceprint?/etc/init.d/mysqld start
啟動mysql
設置MYSQL密碼
view sourceprint?#/usr/bin/mysqladmin -u root -h localhost password '新密碼'
#mysql -u root –p #進入MYSQL,
#Enter Password:
更新MYSQL密碼
view sourceprint?mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql> FLUSH PRIVILEGES;
允許遠程登錄
view sourceprint?mysql>GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
完成后就能用mysql-front遠程管理mysql了。
讓MYSQL數據庫更安全
view sourceprint?mysql -u root -p [此時會要求你輸入剛剛設置的密碼,輸入后回車即可
mysql> DROP DATABASE test; [刪除test數據庫]
mysql> DELETE FROM mysql.user WHERE user =’’; [刪除匿名帳戶]
mysql> FLUSH PRIVILEGES; [重載權限]
mysql> exit; [退出MYSQL]
設為開機啟動
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 [運行HTTPD]
六、測試一下
在/var/www/html/新建個test.php文件,將以下內容寫入,然后保存。
view sourceprint?
phpinfo();
?>
然后在客戶端瀏覽器里打開http://IP/test.php,若能成功顯示,則表示安裝成功。
至此,安裝完畢。
看完上述內容,你們對CentOS LAMP配置是怎樣的有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注創新互聯行業資訊頻道,感謝大家的支持。
網頁名稱:CentOSLAMP配置是怎樣的
文章起源:http://m.kartarina.com/article30/gspipo.html
成都網站建設公司_創新互聯,為您提供營銷型網站建設、關鍵詞優化、小程序開發、網站收錄、ChatGPT、網站排名
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯