Nginx安装
安装依赖
sudo yum install -y pcre pcre-devel
sudo yum install -y openssl openssl-devel
下载并配置Nginx
sudo wget http://nginx.org/download/nginx-1.22.1.tar.gz
sudo tar zxvf nginx-1.22.1.tar.gz
cd nginx-1.22.1
sudo ./configure \
--user=nobody \
--group=nobody \
--prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_sub_module \
--with-http_ssl_module
--with-http_ssl_module 这里就是支持ssl的配置
make && make install
启动
cd /usr/local/nginx/sbin/
sudo ./nginx
安装MySQL
-
当ECS实例操作系统为Alibaba Cloud Linux 3,需安装MySQL依赖包。
sudo yum install compat-openssl10 -
运行以下命令,更新YUM源。
sudo rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-11.noarch.rpm -
运行以下命令,安装MySQL。
sudo yum -y install mysql-community-server -
运行以下命令,查看MySQL版本号。
mysql -V返回结果如下所示,表示MySQL安装成功。
mysql Ver 8.0.36 for Linux on x86_64 (MySQL Community Server - GPL) -
运行以下命令,启动MySQL。
sudo systemctl start mysqld -
依次运行以下命令,设置开机启动MySQL。
sudo systemctl enable mysqld sudo systemctl daemon-reload
配置MySQL
-
运行以下命令,查看
/var/log/mysqld.log文件,获取并记录root用户的初始密码。sudo grep 'temporary password' /var/log/mysqld.log命令行返回结果如下,其中
ARQTRy3+****为MySQL的初始密码。在下一步重置root用户密码时,会使用该初始密码。2021-11-10T07:01:26.595215Z 1 [Note] A temporary password is generated for root@localhost: ARQTRy3+**** -
运行以下命令,配置MySQL的安全性。
sudo mysql_secure_installation-
输入MySQL的初始密码。
说明
在输入密码时,系统为了最大限度地保证数据安全,命令行将不做任何回显。您只需要输入正确的密码信息,然后按
Enter键即可。Securing the MySQL server deployment. Enter password for user root: #输入上一步获取的root用户初始密码 -
设置MySQL的新密码。
The existing password for the user account root has expired. Please set a new password. New password: #输入新密码。长度为8至30个字符,必须同时包含大小写英文字母、数字和特殊符号。特殊符号包含()` ~!@#$%^&*-+=|{}[]:;‘<>,.?/ Re-enter new password: #确认新密码。 The 'validate_password' plugin is installed on the server. The subsequent steps will run with the existing configuration of the plugin. Using existing password for root. Estimated strength of the password: 100 #返回结果包含您设置的密码强度。 Change the password for root ? (Press y|Y for Yes, any other key for No) :Y #您需要输入Y以确认使用新密码。 #新密码设置完成后,需要再次验证新密码。 New password:#再次输入新密码。 Re-enter new password:#再次确认新密码。 Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) :Y #您需要输入Y,再次确认使用新密码。 -
输入
Y删除匿名用户。Remove anonymous users? (Press y|Y for Yes, any other key for No) :Y Success. -
输入
Y禁止使用root用户远程登录MySQL。Disallow root login remotely? (Press y|Y for Yes, any other key for No) :Y Success. -
输入
Y删除test库以及用户对test库的访问权限。Remove test database and access to it? (Press y|Y for Yes, any other key for No) :Y - Dropping test database... Success. - Removing privileges on test database... Success. -
输入
Y重新加载授权表。Reload privilege tables now? (Press y|Y for Yes, any other key for No) :Y Success. All done!
redis安装
yum -y install redis配置必要参数 /etc/redis.conf 比如注释掉bind 那行
-