闲置的笔记本作为个人小服务器记录初始配置;
个人主要作用:
- 小型服务器
- NAS
1.初始配置
1.1 ssh
sudo apt-get install ssh -y
1.2 vim
sudo apt-get install vim -y
1.3更改软件源
备份:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
修改:
sudo vi /etc/apt/sources.list
修改源为:阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
更新源:
sudo apt-get update
sudo apt-get upgrade -y
笔记本合盖子无操作(可选)
sudo vim /etc/systemd/logind.conf
主要选项有:
HandlePowerKey:按下电源键后的动作
HandleSleepKey:按下挂起键后的动作
HandleHibernateKey: 按下休眠键后的动作
HandleLidSwitch:合上笔记本盖后待机
可以选择的值有:
ignore(什么都不做)
poweroff(关机)
reboot(重新启动)
halt(关机,和poweroff有什么区别,需要手动断开电源?)
suspend(待机挂起)
hibernate(休眠)
lock(锁屏)
systemctl restart systemd-logind
ifconfig
sudo apt-get install net-tools -y
docker
安装
sudo apt install docker.io -y
测试
sudo docker --version
sudo docker info
修改docker源-163
sudo vim /etc/docker/daemon.json
daemon.json内容
{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}
重启docker生效
sudo service docker restart
其他软件
- chrome
- teamviewer/向日葵/AnyDesk
2.服务器
jdk
mysql
3.NAS
smba
File server – Samba
FTP server – vsFTPd
Remote access – OpenSSH