自用的lxc容器初始化配置
安装ca-certificates
替换的源是https源,现在不装等下无法更新源。
1
| apt-get install --reinstall ca-certificates -y
|
替换debian源
1
| sed -i "s@http://deb.debian.org@https://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list
|
更新源缓存
设置网络
使用dhcp则不用设置,可跳过。
静态IP设置如下,自行替换IP、网关、DNS。
1 2 3 4 5 6 7 8 9
| mv /etc/systemd/network/eth0.network /etc/systemd/network/eth0.network.bak cat > /etc/systemd/network/eth0.network << EOF [Match] Name=eth0 [Network] Address=192.168.2.105/24 Gateway=192.168.2.1 DNS=192.168.2.1 EOF
|
安装工具
1
| apt install bash-completion curl wget nano -y
|
写入bash-completion配置并使立刻生效
bash-completion是用来增强bash的自动补全功能的
1 2 3 4 5 6 7 8
| cat >> ~/.bashrc << EOF if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi EOF
source ~/.bashrc
|
更改时区
debian
1
| timedatectl set-timezone Asia/Shanghai
|
alpine
1
| setup-timezone -z Asia/Shanghai
|
开启ssh
1
| apt install openssh-server -y
|
修改配置文件使支持root用户密码登录
1
| sed -i "s@#PermitRootLogin prohibit-password@PermitRootLogin yes@g" /etc/ssh/sshd_config
|
重载sshd配置