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