一、CentOS安装Docker
之前QXWA介绍过如何安装Docker,现在可以根据Docker的官方说明简化操作,一键安装:
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
下载使用docker-compose:
curl -L "https://github.com/docker/compose/releases/download/v2.27.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
二、CentOS安装MariaDB
首先从官方网站下载repo文件,并保存:/etc/yum.repos.d/MariaDB.repo
# MariaDB 11.3 CentOS repository list - created 2024-05-13 07:55 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
# rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
# baseurl = https://rpm.mariadb.org/11.3/centos/$releasever/$basearch
baseurl = https://mirrors.xtom.com.hk/mariadb/yum/11.3/centos/$releasever/$basearch
module_hotfixes = 1
# gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgkey = https://mirrors.xtom.com.hk/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1
然后直接执行:
yum install -y MariaDB-server MariaDB-client
三、升级openssl
这里介绍1.1.1版本:https://www.openssl.org/source/old/1.1.1/index.html
mkdir -p /usr/local/openssl
wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz
tar -xf openssl-1.1.1w.tar.gz -C /usr/local
cd /usr/local/openssl-1.1.1w
./config --prefix=/usr/local/openssl
./config -t
make && make install
ldd /usr/local/openssl/bin/openssl
openssl version -a
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
openssl version -a
四、挂载硬盘
fdisk -l
mkfs -t ext4 /dev/vdb
mkdir /data
mount /dev/vdb data
五、MobaXterm设置保持SSH连接
1.MobaXterm客户端设置
需要在设置里点选setting>SSH>sessions setting>勾选ssh Keepalive
2.SSH服务端设置
SSH服务端要设置客户端的超时连接时间,修改/etc/ssh/sshd_config:
ClientAliveCountMax 3 #默认重连3次
ClientAliveInterval 30 #30s重连一次
systemctl restart sshd
即可
六、MySQL关闭默认的Strict Mode
MariaDB默认开启了Strict Mode,通过编辑/etc/my.cnf,在[mysqld]中添加:
sql_mode=NO_ENGINE_SUBSTITUTION
查看:
SELECT @@SESSION.sql_mode;