目录
1.Node的安装
这里使用的是Nodejs的V12.x的版本,基本能满足大部分工具所需的版本。
直接上流程
1. curl -sL https://rpm.nodesource.com/setup_12.x | bash - //下载
2. yum install -y nodejs //yum 安装
3. node --version //查看版本号
2.mysql的安装
我们知道现在mysql都是 MariaDB 进行管理所以直接使用MariaDB来进行mysql相关的安装省去了很麻烦
直接上流程
1. yum install mariadb-server //安装server
2. systemctl start mariadb //开启服务
3. systemctl enable mariadb //设置为开机自启动服务
4. mysql_secure_installation //初始化mysql
//初始化的时候会弹出设置的一些东西
Enter current password for root (enter for none): // 因为是第一次进入还没有设置密码则直接
回车
Set root password? [Y/n] //是否设置密码,y
New password: //root 新密码 建议设置复杂一些
Re-enter new password: // root 再次输入密码
Remove anonymous users? [Y/n] // 为了安全生产环境 建议移除匿名用户, y
Disallow root login remotely? [Y/n] // 拒绝root远程登录,n,如果为了外部访问方便可以先写n,后期 一般云服务器有防火墙可以进行端口封堵
Remove test database and access to it? [Y/n] // 删除test数据库, y 一般测试用的 不用可以删除
Reload privilege tables now? [Y/n] // 刷新当前的权限,y
5. mysql -u root -p //尝试登录下
6. show variables like "%character%";show variables like "%collation%"; //查看当前mysql的编码集
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.01 sec)
+----------------------+-------------------+
| Variable_name | Value |
+----------------------+-------------------+
| collation_connection | utf8_general_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
+----------------------+-------------------+
3 rows in set (0.00 sec)
7. 修改不是utf8的编码集
a. vim /etc/my.cnf
b. 在 [mysqld] 标签下添加
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
c. vim /etc/my.cnf.d/client.cnf 文件
d. 在 [client] 标签下添加
default-character-set=utf8
e. vim /etc/my.cnf.d/mysql-clients.cnf 文件
在 [mysql] 标签下添加
default-character-set=utf8
8. 重启服务
systemctl restart mariadb
9. 再次查看
MariaDB [(none)]> show variables like "%character%";show variables like "%collation%";
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_unicode_ci |
| collation_database | utf8_unicode_ci |
| collation_server | utf8_unicode_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)
4.redis安装
这个没啥好说的直接流程
1. yum install -y epel-release bash-completion //安装 epel
2. yum install -y https://repo.ius.io/ius-release-el7.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm //安装官方版语法
3. yum install -y redis5 // 安装redis5
4. rpm -ql redis5 //查看redis5 rpm 相关文件
5. vim /etc/redis.conf
//找到 daemonize no 改为 daemonize yes 意思是使用守护进程的方式启动
6. service redis start 或 systemctl start redis //启动redis
7. chkconfig redis on 或 systemctl enable redis.service //开机自启动
5.nginx安装
nginx没有找到rpm相关的文章,但是官网有,安装的应该是最新的nginx版本,不过我用的不是最新版的 我用的是1.16.1版本 用的比较熟了所有没有使用官方的rpm安装方式。
1. sudo yum install yum-utils
2. touch /etc/yum.repos.d/nginx.repo
3. vim /etc/yum.repos.d/nginx.repo //插入以下代码
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
4. sudo yum-config-manager --enable nginx-mainline
5. sudo yum install nginx // 安装
6. nginx -v //查看当前版本
7. systemctl enable nginx.service //开启开机启动
8.
systemctl start nginx.service //启动
systemctl reload nginx.service //重载配置
systemctl restart nginx.service //重启
systemctl stop nginx.service //停止
我使用的是 自己下载1.16.1安装包进行下载安装。在手动安装之前首先系统里面必须安装了openSSH ,GCC。
1.下载包
wget http://nginx.org/download/nginx-1.16.1.tar.gz
2. 解压包
tar -zxvf nginx-1.16.1.tar.gz
3. cd nginx-1.16.1 // 进入到目录下
4. ./configure //检查配置
5. make //编译
6. make install //安装
7. vim /usr/lib/systemd/system/nginx.service //编写service 文件方便启动和停止
8. chmod +x /usr/lib/systemd/system/nginx.service //给文件附加执行权限
9. systemctl enable nginx.service //添加到系统开机启动
10.
systemctl start nginx.service //启动
systemctl reload nginx.service //重载配置
systemctl restart nginx.service //重启
systemctl stop nginx.service //停止