服务器环境配置查阅小册

前言

在平时的开发过程中会碰到很多的服务器配置问题,这里做个总结,供重装系统后查阅,以下操作都是在 Debian 10 操作系统下进行。

服务器配置

镜像源

修改 /etc/apt/source.list 文件

deb https://mirrors.aliyun.com/debian/ buster main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ buster main non-free contrib
deb https://mirrors.aliyun.com/debian-security buster/updates main
deb-src https://mirrors.aliyun.com/debian-security buster/updates main
deb https://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb https://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ buster-backports main non-free contrib

关闭睡眠

systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

网络

# The primary network interface
auto ens192
iface ens192 inet static
address 192.168.3.21
netmask 255.255.255.0
gateway 192.168.3.1

时区

这里我使用的是 Debian 10,所以就用 Debian 来进行配置。以下操作都使用 root用户进行操作,如果使用的是其他用户,请在命令前添加 sudo

  1. 使用命令 timedatectl 来查看当前的时间和时区。
  2. 然后使用 timedatectl list-timezones 来查看所有的时区,我们一般的服务器都在国内部署服务,所以使用 Asia/Shanghai
  3. 最后使用 timedatectl set-timezone Asia/Shanghai 来把时区设置成东八区。

MySQL配置

安装

MySQL 8.0+ 表名忽略大小写需要初始化就配置,后续配置无效

docker run -itd --name mysql -v ~/env/mysql/conf:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 mysql --lower-case-table-names=1

时区

这里我使用的是 MySQL 5.7,只需在 MySQL 的配置文件中添加时区,然后重启就好了。

[mysqld]
...
default-time_zone='+8:00'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

爱摸鱼的阿恒

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值