前言
今日家中新到了一台戴尔服务器,原本按照预想,打算给服务器装上一个Ubuntu 22.04LTS,但是因依赖问题被迫重装,因此这里记录一下详细过程,给自己留个备份.
root账号密码设置
打开终端,并输入sudo passwd root
来设置root密码
更换apt镜像清华源
sudo sed -i “s@http://.*archive.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g” /etc/apt/sources.list
sudo sed -i “s@http://.*security.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g” /etc/apt/sources.list
apt update
apt upgrade
然后再安装一些基础插件
apt install vim neofetch curl
配置ssh端口及密码
先执行apt install openssh-server
来安装ssh,接着通过vim /etc/ssh/sshd_config
来编辑ssh配置文件
先按i进入编辑模式
Port 22 #找到这一行并删除最前面的#号
PermitRootLogin no#找到PermitRootLogin这一行,删除#,同时将后面改为yes
PasswordAuthentication yes #同样删除前面的注释
最后按esc,再输入:wq退出并保存
之后重启ssh服务
systemctl restart ssh
设置ssh开机自启
systemctl enable ssh
此时重启,服务器应该就能通过ssh连接了(如果连不上请检查你的运营商或主机防火墙设置)
基础配置环节到此结束,web环境搭建部分下次再讲吧~