这里记录ubuntu22.04一些基本操作配置,方便后续配置时查看使用
首先我们安装openssh和允许root账户登录系统
sudo apt update
sudo apt install openssh-server1.配置sudo切换无需输入密码
sudo chmod 640 /etc/sudoers
sudo vi /etc/sudoers
%sudo ALL=(ALL:ALL) ALL下面添加,例如我的账户是ubuntu
ubuntu ALL=(ALL:ALL) NOPASSWD: ALL
#保存退出以后修改回原来权限
sudo chmod 440 /etc/sudoers2.配置可以使用root登录
vi /etc/ssh/sshd_config
PermitRootLogin yes #PermitRootLogin对应的值改为yes接着我们给root账户设置下密码即可
sudo -s
输入密码后使用passwd root进行修改密码
passwd root输入密码以后,重启sshd服务
systemctl restart sshd3.配置本地时区为上海
sudo timedatectl set-timezone Asia/Shanghai
timedatectl #验证同步系统时间
apt install ntpdate -y
ntpdate pool.ntp.org4.配置网络为静态IP
如果是临时设置下静态IP可以使用ip命令
sudo ip addr add 192.168.0.100/24 dev eth0
sudo ip route add default via 192.168.0.1
使用配置文件固化设置静态IP
sudo vi /etc/netplan/50-cloud-init.yaml
network:
ethernets:
eth0:
dhcp4: no
addresses: [192.168.0.180/24]
gateway4: 192.168.0.1
nameservers:
addresses: [114.114.114.114, 8.8.8.8]
version: 2
退出编辑状态下,然后保存配置到系统即可,注意:如果保存以后重启以后配置的静态IP失效了,就去
cat /etc/cloud/cloud.cfg.d/目录下配置90-installer-network.cfg这个文件,不同版本的可能稍微有一点区别,可以分别看看这个目录下的文件。
suod netplan apply然后使用ifconfig命令进行查看当前配置的静态是否已经生效,ifconfig如果执行不了需要进行安装
apt install net-tools5.更换APT源
更换apt源的方法如下,下面是替换的清华源或者是阿里源,注意ubuntu22.04版本代号为jammy
sudo vi /etc/apt/sources.list
#清华源
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
#阿里源
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse上述两种源,可以选择复制进去一种然后保存退出,更新源码包列表
sudo apt update6.挂载硬盘
首先需要获取硬盘的设备名字和类型,创建挂载目录,然后进行挂载
lsblk -f mkdir -p /mnt/hdiskmount -t ntfs /dev/sdc1 /mnt/hdisk
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:https://sulao.cn/post/781
相关阅读
- ubuntu22.04算力环境基础配置一键验证脚本
- ubuntu22.04算力环境基础配置一键脚本
- ubuntu22.04忘记root密码进入单用户模式修改密码
- ubuntu22.04屏蔽使用apt安装软件时出现弹窗要求选择重启服务的方法
- ubuntu22.04删除系统中的新内核并回退的方法
- ubuntu22.04部署chrony时间同步服务
- ubuntu22.04部署ntp时间同步服务器
- ubuntu22.04切换cgroup v2到cgroup v1
- ubuntu22.04安装nvidia-fabricmanager
- ubuntu22.04使用containerd部署k8s单master集群
评论列表