1、Centos6系統(tǒng)庫中默認(rèn)是沒有nginx的rpn包的,,所以我們需要先更新下rpm依賴庫 (1):使用yum安裝nginx,,安裝nginx庫 rpm -Uvh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm (2):使用下面命令安裝nginx yum -y install nginx (3):啟動nginx service nginx start #centos6 或 systemctl start nginx.service #centos7 (4):防火墻允許通過80端口 vim /etc/sysconfig/iptables # Generated by iptables-save v1.4.7 on Thu Dec 28 19:47:19 2017 *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [21691:949300] -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT (5):重啟防火墻 service iptables restart (6):訪問網(wǎng)站,查看是否出現(xiàn) 'Welcome To Nginx',,如果想更改網(wǎng)站根目錄,修改地址:vim /etc/nginx/conf.d/default.conf,,修改Root 后面的路徑,,詳細(xì)請參考:Liscookie
2、安裝Mysql,,先更新yum源 (1):yum源下載地址,,根據(jù)自己需要的版本選擇相應(yīng)的源 https://dev.mysql.com/downloads/repo/yum/ (2):我們版本是6.x的,所以選擇linux 6 下載 wget https://repo.mysql.com//mysql57-community-release-el6-11.noarch.rpm (3):安裝mysql的yum源 rpm -Uvh mysql57-community-release-el6-11.noarch.rpm 或 yum -y localinstall mysql57-community-release-el6-11.noarch.rpm (4):查看是否配置mysql源成功 在/etc/yum.repos.d下面 (5):安裝Mysql yum -y install mysql-community-server #時間有點(diǎn)長,,稍微等一下 (6):開始mysql服務(wù) service mysqld start (7):Mysql安裝成功之后,,會自動創(chuàng)建root的密碼,存儲在/var/log/mysqld.log,,可以通過以下命令來查看 grep 'temporary password' /var/log/mysqld.log (8):登錄mysql,,修改密碼 mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Wang123!'; (9):開啟遠(yuǎn)程鏈接,iptables開放3306端口 vim /etc/sysconfig/iptables (10):重啟防火墻使iptables生效 service iptables restart 3,、安裝PHP (1):更新yum源 rpm -Uvh http://ftp.iij./pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm (2):安裝PHP yum -y install --enablerepo=remi --enablerepo=remi-php56 php php-bcmath php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-gd php-xml php-memcache php-redis php-fpm php-mysql php-common php-mssql (3):配置php.ini文件,,關(guān)閉php信息頭 vim /etc/php.ini #366行左右 expose_php = Off #關(guān)閉phpxinxi (4):啟動PHP,設(shè)置開機(jī)啟動 service php-fpm restart #啟動php chkconfig php-fpm --level 2345 on #設(shè)置開機(jī)啟動 OK,至此,,已經(jīng)安裝完成了LNMP |
|
來自: 昵稱54185769 > 《待分類》