centos8版本快速部署nginx,mysql安装
星期二, 2020-01-21 | Author: Lee | JAVA-and-J2EE, linux | 2,259 views
0.centos8版本快速部署nginx,mysql安装
1.系统预检 查看版本
cat /etc/redhat-release |
初始系统为8.0版本,执行更新后为8.1:
yum update cat /etc/redhat-release |
CentOS Linux release 8.1.1911 (Core)
2.前置安装需要的包文件
yum install wget yum install pcre yum install pcre-devel yum install openssl* yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients make yum -y install gd gd-devel /usr/sbin/groupadd www /usr/sbin/useradd -s /sbin/nologin -g www www -M ulimit -SHn 65535 mkdir -p /ia/data/installsoft cd /ia/data/installsoft wget http://nginx.org/download/nginx-1.16.1.tar.gz tar xzvf nginx-1.16.1.tar.gz cd nginx-1.16.1/ ./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre --with-http_realip_module --with-http_image_filter_module --with-http_v2_module --with-stream make make install /usr/local/webserver/nginx/sbin/nginx -V |
启动 /usr/local/webserver/nginx/sbin/nginx
简要的配置开启
user = www www; //开启gzip压缩 gzip on; //关闭Nginx版本号显示 server_tokens off; //增加最大上传文件大小 client_max_body_size 8M; |
3.升级到centos8版本后解决内存不足的问题
虚拟内存的话,也就是物理内存的2倍左右,这里设置2g的虚拟内存
free -m 查看内存,根据情况设置内存,
dd if=/dev/zero of=/opt/swap bs=1M count=2048 chmod 600 /opt/swap mkswap /opt/swap swapon /opt/swap ###或者快速一种 sudo fallocate -l 2G /tmp/swapfile sudo chmod 600 /tmp/swapfile sudo mkswap /tmp/swapfile sudo swapon /tmp/swapfile |
最后查看内存设置情况
free -m
4.安装mysql
centos8下默认的yum源就是mysql8的版,可以直接yum安装,也可以到mysql官网下载最新的导入安装
安装MySQL8及对应工具:
yum install mysql mysql-server
启动MySQL服务器:
systemctl start mysqld
然后是初始化MySQL,命令如下:
mysql_secure_installation |
启动操作及新增用户设置等
systemctl start mysqld #启动MySQL systemctl stop mysqld #关闭MySQL systemctl restart mysqld #重启MySQL systemctl status mysqld #查看MySQL运行状态 systemctl enable mysqld #设置开机启动 systemctl disable mysqld #关闭开机启动 ###输入上面安装的root密码,创建新用户及赋权 mysql -uroot -p use mysql; select host,user from user; ###此命令在5.7版本是可以的,在8.x系列需要分两步才行: GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY '123456'; GRANT ALL PRIVILEGES ON *.* TO 'admin'@'127.0.0.1' IDENTIFIED BY '123456'; GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' IDENTIFIED BY '123456'; ####mysql8.0创建用户及赋权 create user 'admin'@'localhost' identified by '123456'; GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION; create user 'admin'@'127.0.0.1' identified by '123456'; GRANT ALL PRIVILEGES ON *.* TO 'admin'@'127.0.0.1' WITH GRANT OPTION; create user 'admin'@'%' identified by '123456'; GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION; select host,user from user; FLUSH PRIVILEGES; vi /etc/my.cnf [mysqld] lower_case_table_names=1 |
文章作者: Lee
本文地址: https://www.pomelolee.com/2010.html
除非注明,Pomelo Lee文章均为原创,转载请以链接形式标明本文地址
No comments yet.
Leave a comment
Search
相关文章
热门文章
最新文章
文章分类
- ajax (10)
- algorithm-learn (3)
- Android (6)
- as (3)
- computer (85)
- Database (30)
- disucz (4)
- enterprise (1)
- erlang (2)
- flash (5)
- golang (3)
- html5 (18)
- ios (4)
- JAVA-and-J2EE (186)
- linux (143)
- mac (10)
- movie-music (11)
- pagemaker (36)
- php (50)
- spring-boot (2)
- Synology群晖 (2)
- Uncategorized (6)
- unity (1)
- webgame (15)
- wordpress (33)
- work-other (2)
- 低代码 (1)
- 体味生活 (40)
- 前端 (21)
- 大数据 (8)
- 游戏开发 (9)
- 爱上海 (19)
- 读书 (4)
- 软件 (3)