标签:lis please pre lte x86 mirror exist generated state
环境准备‘关闭防火墙和selinux‘
[root@arongya ~]# systemctl stop firewalld
[root@arongya ~]# systemctl disable firewalld
[root@arongya ~]# setenforce 0
[root@arongya ~]# sed -ri ‘s/(SELINUX=).*/\1disabled/g‘ /etc/selinux/config
配置nginx
‘创建系统组和用户‘
[root@arongya ~]# groupadd -r nginx
[root@arongya ~]# useradd -M -s /sbin/nologin -g nginx nginx
‘安装依赖包‘
[root@arongya ~]# yum -y install pcre-devel openssl openssl-devel gd-devel
[root@arongya ~]# yum -y groups mark install ‘Development Tools‘
‘检查安装Development Tools 是否安装成功‘
[root@arongya ~]# yum grouplist
‘创建日志存放目录以及更改存放日志目录属组和属主‘
[root@arongya ~]# mkdir -p /var/log/nginx
[root@arongya ~]# chown -R nginx.nginx /var/log/nginx
‘下载nginx‘
[root@arongya ~]# cd /usr/src/
[root@arongya src]# yum install wget
[root@arongya src]# wget http://nginx.org/download/nginx-1.14.0.tar.gz
[root@arongya src]# ls
debug kernels nginx-1.14.0.tar.gz
‘解压‘
[root@arongya src]# tar xf nginx-1.14.0.tar.gz
‘编译安装‘
[root@arongya src]# cd nginx-1.14.0/
[root@arongya nginx-1.14.0]# ./configure > --prefix=/usr/local/nginx > --user=nginx > --group=nginx > --with-debug > --with-http_ssl_module > --with-http_realip_module > --with-http_image_filter_module > --with-http_gunzip_module > --with-http_gzip_static_module > --with-http_stub_status_module > --http-log-path=/var/log/nginx/access.log > --error-log-path=/var/log/nginx/error.log
[root@arongya nginx-1.14.0]# make -j $(grep ‘processor‘ /proc/cpuinfo | wc -l) && make install
nginx安装后配置
‘配置环境变量‘
[root@arongya ~]# echo ‘export PATH=/usr/local/nginx/sbin:$PATH‘ > /etc/profile.d/nginx.sh
[root@arongya ~]# . /etc/profile.d/nginx.sh
‘启动nginx‘
[root@arongya ~]# nginx
[root@arongya ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:80 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
在浏览器上输入本主机的IP地址看是否能访问,例如本主机IP是:192.168.228.30,如图所示:
安装MYSQL
‘安装依赖包‘
[root@arongya ~]# yum -y install ncurses-devel openssl-devel openssl cmake mariadb-devel
‘创建mysql的系统用户和组‘
[root@arongya ~]# groupadd -r -g 306 mysql
[root@arongya ~]# useradd -M -s /sbin/nologin -g 306 -u 306 mysql
‘下载二进制格式的mysql的软件包‘
[root@arongya ~]# cd /usr/src/
[root@arongya src]# wget https://downloads.mysql.com/archives/get/file/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
‘解压软件至/usr/local/‘
[root@arongya src]# tar xf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@arongya src]# tar xf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@arongya src]# ls /usr/local/
bin include libexec sbin
etc lib mysql-5.7.22-linux-glibc2.12-x86_64 share
games lib64 nginx src
[root@arongya src]# cd /usr/local/
[root@arongya local]# ln -sv mysql-5.7.22-linux-glibc2.12-x86_64/ mysql
‘mysql’ -> ‘mysql-5.7.22-linux-glibc2.12-x86_64/’
[root@arongya local]# ll
total 0
drwxr-xr-x. 2 root root 6 Nov 5 2016 bin
drwxr-xr-x. 2 root root 6 Nov 5 2016 etc
drwxr-xr-x. 2 root root 6 Nov 5 2016 games
drwxr-xr-x. 2 root root 6 Nov 5 2016 include
drwxr-xr-x. 2 root root 6 Nov 5 2016 lib
drwxr-xr-x. 2 root root 6 Nov 5 2016 lib64
drwxr-xr-x. 2 root root 6 Nov 5 2016 libexec
lrwxrwxrwx. 1 root root 36 Aug 24 16:29 mysql -> mysql-5.7.22-linux-glibc2.12-x86_64/
drwxr-xr-x. 9 root root 129 Aug 24 16:28 mysql-5.7.22-linux-glibc2.12-x86_64
‘修改目录/usr/local/mysql的属主属组‘
[root@arongya ~]# chown -R mysql.mysql /usr/local/mysql
[root@arongya ~]# ll /usr/local/mysql -d
lrwxrwxrwx. 1 mysql mysql 36 Aug 24 16:29 /usr/local/mysql -> mysql-5.7.22-linux-glibc2.12-x86_64/
‘添加环境变量‘
[root@arongya ~]# ls /usr/local/mysql
bin docs lib README support-files
COPYING include man share
[root@arongya ~]# echo ‘export PATH=/usr/local/mysql/bin:$PATH‘ > /etc/profile.d/mysql.sh
[root@arongya ~]# . /etc/profile.d/mysql.sh
[root@arongya ~]# echo $PATH
/usr/local/mysql/bin:/usr/local/nginx/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
‘建立数据存放目录‘
[root@arongya ~]# mkdir /opt/data
[root@arongya ~]# chown -R mysql.mysql /opt/data/
[root@arongya ~]# ll /opt/
total 0
drwxr-xr-x. 2 mysql mysql 6 Aug 24 16:33 data
‘初始化数据库‘
[root@arongya ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --datadir=/opt/data/
2018-08-24T08:34:51.043748Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-08-24T08:34:52.915665Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-08-24T08:34:53.347600Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-08-24T08:34:53.418106Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 92b6fee8-a778-11e8-8c4e-000c29b52e8f.
2018-08-24T08:34:53.540420Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.
2018-08-24T08:34:53.544447Z 1 [Note] A temporary password is generated for root@localhost: gz(Ist:C;6_6
‘这个命令最后会生成一个临时密码,此处密码是gz(Ist:C;6_6‘
‘配置mysql‘
[root@arongya ~]# ln -sv /usr/local/mysql/include/ /usr/local/include/mysql
‘/usr/local/include/mysql’ -> ‘/usr/local/mysql/include/’
[root@arongya ~]# echo ‘/usr/local/mysql/lib‘ > /etc/ld.so.conf.d/mysql.conf
[root@arongya ~]# ldconfig -v
‘生成配置文件‘
[root@arongya ~]# cat > /etc/my.cnf <<EOF
> [mysqld]
> basedir = /usr/local/mysql
> datadir = /opt/data
> socket = /tmp/mysql.sock
> port = 3306
> pid-file = /opt/data/mysql.pid
> user = mysql
> skip-name-resolve
> EOF
‘配置服务启动脚本‘
[root@arongya ~]# cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@arongya ~]# sed -ri ‘s#^(basedir=).*#\1/usr/local/mysql#g‘ /etc/init.d/mysqld
[root@arongya ~]# sed -ri ‘s#^(datadir=).*#\1/opt/data#g‘ /etc/init.d/mysqld
‘启动mysql‘
[root@arongya ~]# service mysqld start
Starting MySQL.Logging to ‘/opt/data/arongya.err‘.
. SUCCESS!
[root@arongya ~]# ps -ef |grep mysql
root 4829 1 0 16:44 pts/1 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/opt/data --pid-file=/opt/data/mysql.pid
mysql 5007 4829 3 16:44 pts/1 00:00:00 /usr/localmysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/opt/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=arongya.err --pid-file=/opt/data/mysql.pid --socket=/tmp/mysql.sock --port=3306
root 5039 1760 0 16:44 pts/1 00:00:00 grep --color=auto mysql
[root@arongya ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:80 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 80 :::3306 :::*
‘修改密码(使用临时密码登录)‘
root@arongya ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.22
‘设置新密码‘
mysql> set password = password(‘yaoxiaorong!‘);
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> quit
Bye
安装php
‘配置yum源‘
[root@arongya ~]# cd /etc/yum.repos.d/
[root@arongya yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
--2018-08-24 16:48:23-- http://mirrors.163.com/.help/CentOS7-Base-163.repo
Resolving mirrors.163.com (mirrors.163.com)... 59.111.0.251
Connecting to mirrors.163.com (mirrors.163.com)|59.111.0.251|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1572 (1.5K) [application/octet-stream]
Saving to: ‘CentOS7-Base-163.repo’
100%[===================>] 1,572 --.-K/s in 0s
2018-08-24 16:48:23 (46.9 MB/s) - ‘CentOS7-Base-163.repo’ saved [1572/1572]
[root@arongya yum.repos.d]# sed -i ‘s/\$releasever/7/g‘ /etc/yum.repos.d/CentOS7-Base-163.repo
[root@arongya yum.repos.d]# sed -i ‘s/^enabled=.*/enabled=1/g‘ /etc/yum.repos.d/CentOS7-Base-163.repo
[root@arongya yum.repos.d]# yum -y install epel-release
‘安装依赖包‘
[root@arongya ~]# yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel mhash mhash-devel
‘下载php‘
[root@arongya yum.repos.d]# cd /usr/src/
[root@arongya src]# wget http://cn.php.net/distributions/php-7.2.8.tar.xz
‘编译安装php‘
[root@arongya php-7.2.8]# tar xf php-7.2.8.tar.xz
[root@arongya php-7.2.8]# cd php-7.2.8/
[root@arongya php-7.2.8]# ./configure --prefix=/usr/local/php7 > --with-curl > --with-freetype-dir > --with-gd > --with-gettext > --with-iconv-dir > --with-kerberos > --with-libdir=lib64 > --with-libxml-dir=/usr > --with-mysqli=/usr/local/mysql/bin/mysql_config > --with-openssl > --with-pcre-regex > --with-pdo-mysql > --with-pdo-sqlite > --with-pear > --with-jpeg-dir > --with-png-dir > --with-xmlrpc > --with-xsl > --with-zlib > --with-config-file-path=/etc > --with-config-file-scan-dir=/etc/php.d > --with-bz2 > --enable-fpm > --enable-bcmath > --enable-libxml > --enable-inline-optimization > --enable-mbregex > --enable-mbstring > --enable-opcache > --enable-pcntl > --enable-shmop > --enable-soap > --enable-sockets > --enable-sysvsem > --enable-xml > --enable-zip
标签:lis please pre lte x86 mirror exist generated state
原文地址:http://blog.51cto.com/13835001/2164023