1.下載dvd.iso安裝文件,下載地址:https://www.centos.org/download/php
我選擇的是DVD.iso的版本,你們自行查詢三個版本的不一樣,對於我來講DVD版本已經夠了,最好用迅雷下載,本地下載太慢了java
2.系統(設置)->啓動順序改成光驅軟驅硬盤mysql
3.存儲(設置)->點擊盤片,選擇以前下載的.iso文件linux
4.網絡設置爲橋接模式,主機與虛擬機能夠互通nginx
幾種網絡模式的介紹:https://www.douban.com/group/topic/15558388/sql
5.點擊啓動進入系統安裝centos
6.最小化安裝、虛擬硬盤自動分區,設置root密碼bash
7.安裝成功後,從新啓動服務器
8.最簡安裝的系統不存在ifconfig命令,咱們在系統上安裝一下網絡
yum provides ifconfig 或 yum whatprovides ifconfig
查詢到ifconfig命令是依賴於 net-tools軟件的,因此咱們來安裝net-tools軟件
yum install -y net-tools
測試到ifconfig命令能夠用了(以前能夠用ip addr命令代替)
9:初始wget軟件安裝
yum install -y wget
10:初始安裝killall命令,nginx及其餘服務啓動關閉時會使用
yum install psmisc
11:若有須要,需設置靜態IP啓用,之後重啓就能夠一直用這個IP了,因爲我本身公司網絡配置,我沒有設置。
vi /etc/sysconfig/network-scripts/ifcfg-****文件 BOOTPROTO="dhcp"修改成BOOTPROTO="static" 添加:IPADDR=10.200.79.123 設置的靜態 ip地址 重啓網絡服務:service network restart 而後由於設置靜態IP的緣由出現了網絡鏈接不上的問題,經解決:公司網段設置的問題,致使主機和虛擬機不在同一個網段,可是不影響互相訪問,公司內的同事也能夠訪問個人虛擬機
參考地址:https://blog.csdn.net/faith306/article/details/78541974
根據文章安裝完成後,啓動nginx的過程當中遇到幾個問題
[root@bogon rewrite]# /selfdata/server/nginx-1.12.2/sbin/nginx nginx: [emerg] unknown log format "main" in /selfdata/server/nginx-1.12.2/nginx.conf:26
上面文章中沒有main的定義,而且log_format定義在access_log使用main的下面,更改成
[root@bogon rewrite]# /selfdata/server/nginx-1.12.2/sbin/nginx nginx: [emerg] open() "/selfdata/logs/nginx/access/default.log" failed (2: No such file or directory)
這裏是由於:/selfdata/logs/nginx/文件夾下面access文件夾不存在致使的,建立便可,之因此須要這個文件夾,是由於在nginx的服務器配置conf/vhosts/default.conf配置文件中配置了這個日誌的地址。access和error文件夾都要建立
[root@bogon nginx]# /selfdata/server/nginx-1.12.2/sbin/nginx [root@bogon nginx]# nginx: [emerg] open() "/selfdata/server/nginx-1.12.2/logs/nginx.pid" failed (2: No such file or directory)
經網上查詢,須要配置nginx程序對應的配置文件。並且須要建立logs文件夾,nginx目錄下初始化安裝完時裏面是沒有這個目錄的。
[root@bogon nginx-1.12.2]# mkdir logs [root@bogon nginx-1.12.2]# /selfdata/server/nginx-1.12.2/sbin/nginx -c /selfdata/server/nginx-1.12.2/nginx.conf
[root@bogon nginx-1.12.2]# /selfdata/server/nginx-1.12.2/sbin/nginx nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] still could not bind()
我分兩步來解決
~~~防止文章丟失,我再抄一遍:
[root@localhost ~]# yum install iptables-services [root@localhost ~]# systemctl mask firewalld.service [root@localhost ~]# systemctl enable iptables.service [root@localhost ~]# systemctl enable ip6tables.service
進入iptables配置80端口,由於nginx默認是由80端口訪問
[root@localhost ~]# vi /etc/sysconfig/iptables
這是配置信息:
# Generated by iptables-save v1.4.21 on Fri May 12 21:28:29 2017 *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [6:696] -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 21 -j ACCEPT(我給vsftpd配置的端口) -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT(給nginx配置的端口,原樣輸入就好了) -A INPUT -p tcp -m state --state NEW -m tcp --dport 30000:30999 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT # Completed on Fri May 12 21:28:29 2017
而後:wq,保存退出就好了;
重啓iptables,配置才生效;
[root@localhost ~]# systemctl restart iptables.service
開啓防火牆,無論你開沒有,再開一遍:
[root@localhost ~]# systemctl start firewalld
開啓http訪問
[root@localhost ~]# firewall-cmd --permanent --add-service=http
加入80端口
[root@localhost ~]# firewall-cmd --permanent --zone=trusted --add-port=80/tcp
~~~抄完了
以後仍是報錯
[root@bogon nginx-1.12.2]# killall -9 nginx [root@bogon nginx-1.12.2]# /selfdata/server/nginx-1.12.2/sbin/nginx [root@bogon nginx-1.12.2]# ps -ef|grep nginx
啓用成功了
將nginx加入服務和開機啓動的操做沒有實踐成功,開啓的過程當中報錯了,因此我沒加,先忽略的這部分
用上面文章參考安裝失敗了,查閱資料。參考另外一個地址:https://blog.csdn.net/xiao_zhui/article/details/72556781;該文章主要是參考安裝組件部分,php編譯安裝以前須要這些組件支持
我再複製下來,
yum -y install libxml2 yum -y install libxml2-devel yum -y install openssl yum -y install openssl-devel yum -y install curl yum -y install curl-devel yum -y install libjpeg yum -y install libjpeg-devel yum -y install libpng yum -y install libpng-devel yum -y install freetype yum -y install freetype-devel yum -y install pcre yum -y install pcre-devel yum -y install libxslt yum -y install libxslt-devel yum -y install bzip2 yum -y install bzip2-devel
# ./configure --prefix=/selfdata/server/php-7.1.11 --with-config-file-path=/selfdata/server/php-7.1.11/etc --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-pdo --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip --enable-calendar # make # make install # cp /selfdata/package/php-7.1.11/php.ini-production /selfdata/server/php-7.1.11/etc/php.ini # cd /selfdata/server/php-7.1.11/etc # cp php-fpm.conf.default php-fpm.conf # cd /selfdata/server/php-7.1.11/etc/php-fpm.d # cp www.conf.default www.conf # vi /selfdata/server/php-7.1.11/etc/php-fpm.conf ~~修改內容 pid= /selfdata/server/php-7.1.11/var/run/php-fpm.pid ~~~內容結束 #vi /selfdata/server/php-7.1.11/etc/php-fpm.d/www.conf ~~~內容 user = www group = www listen = 127.0.0.1:9000 pm.max_children = 100 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 ~~~內容
mysql第一次安裝時直接按照第一篇參考資料安裝的,直接文件夾安裝的,遇到了不少的錯誤,並且最後始終是提醒缺乏PID文件,而且啓用不起來,並且沒有錯誤日誌,實在沒辦法,選擇了卸載,從新安裝,從新啊安裝採用的yum安裝的
1.卸載原有mysql殘餘,在網絡查詢如何徹底下載
2.yum mysql安裝參考:
https://www.linuxidc.com/Linux/2016-09/135288.htm
3.安裝完成以後須要進行初始的訪問設置,用戶設置這些
參考:
http://www.javashuo.com/article/p-dmmqvwqy-r.html
http://www.javashuo.com/article/p-xismmipp-do.html