Linux服务器管理(系统重装、账号配置、驱动安装)

本文详细介绍了在Linux系统(如Ubuntu20.04)中进行系统重装、配置IP、固定IP、SSH设置、账号管理(包括创建、删除和提升权限)以及NVIDIA显卡驱动的安装和配置过程,强调了权限控制和驱动冲突的解决方法。
摘要由CSDN通过智能技术生成

目录

一、系统重装

1.1 重装系统

1.2 重装后需要配置ip并固定 (非必要)

1.3 配置ssh

二、账号配置

2.1 开账号、删除账号

2.2 把用户升级为root级别

三、NVIDIA显卡驱动配置

3.1. 验证是否禁用nouveau: lsmod | grep nouveau

3.2. 卸载旧版本显卡驱动sudo apt-get remove --purge nvidia* 或者 nvidia-uninstall

3.3.  给文件赋予安装权限 ,变黄即可

3.4.  安装,不需要X校验,不需要安装Opengl

3.5. 关于提问


一、系统重装

1.1 重装系统

链接配置如下:【精选】0.0 Windows + Linux(Ubuntu20.04) 超简单的双系统安装_boot loader installation 安装在哪-CSDN博客

1.2 重装后需要配置ip并固定 (非必要)

需要使用工具:如何在 Linux 上使用网络配置工具 Netplan - 知乎 (zhihu.com)

 ifconfig

静态ip 

1.3 配置ssh

# linxu 下的ssh安装

sudo apt update        #更新数据
sudo apt upgrade        #更新软件
sudo apt-get install ssh


# 更新安装完毕后
sudo apt-get  install openssh-server 
sudo apt install openssh-server  #下载安装ssh服务的服务器
sudo apt install openssh-client  #下载安装ssh服务的客户端

# 检查ssh是否存在
ps -e|grep ssh 

# 启动ssh
ssh localhost
/etc/init.d/ssh start

#  设置开机自启动
sudo systemctl enable ssh

# 设置好后重启
reboot



二、账号配置

2.1 开账号、删除账号

# 创建账户
sudo useradd -m -s /bin/bash userName

# 账户密码
sudo passwd userName

# 删除账号
sudo userdel -r userName

2.2 把用户升级为root级别

参考以下文章:

Linux中把普通用户提升为root用户权限_linux怎么升级root-CSDN博客

Linux系统中将普通用户权限提升至root权限_linux 普通用户给予超级权限-CSDN博客

Linux中把普通用户提升为root用户权限:

1、修改/etc/passwd即可,把用户名的ID和ID组修改成0。

2、修改/etc/group相关内容。

但不建议将普通用户提升为root,不然linux的权限设计就没有意义了。

所以最好使用sudo命令来赋予普通用户root的权限以保障系统安全

sudo su


vim /etc/sudoers

修改完毕 esc : wq 保存并退出
 vim /etc/passwd

三、NVIDIA显卡驱动配置

参考:超全超详细的安装nvidia显卡驱动教程_nvidia驱动安装csdn-CSDN博客

3.1. 验证是否禁用nouveau: lsmod | grep nouveau

# 查看服务器运行版本
uname -a

# 查看显卡型号
lspci | grep -i nvidia

# 禁用nouveau并重启(安装Nvidia显卡的官方驱动和系统自带的nouveau驱动冲突)
# 有输出则代表没有禁用
lsmod | grep nouveau


# 打开禁用列表/etc/modprobe.d/blacklist.conf, 在最后一行加上
blacklist nouveau
options nouveau modeset=0


# 更新再重启
sudo update-initramfs -u
reboot


# 再次检查
lsmod | grep nouveau

3.2. 卸载旧版本显卡驱动sudo apt-get remove --purge nvidia* 或者 nvidia-uninstall

# 卸载之前的nvdia,一般用这个
sudo apt-get remove --purge nvidia*  

#以前是通过runfile安装的,卸载如下:
sudo ./NVIDIA-Linux-x86_64-384.59.run --uninstall

3.3.  给文件赋予安装权限 ,变黄即可


sudo chmod  a+x NVIDIA-Linux-x86_64-525.105.17.run 

3.4.  安装,不需要X校验,不需要安装Opengl

sudo ./NVIDIA-Linux-x86_64-525.105.17.run -no-x-check  -no-opengl-files

3.5. 关于提问

安装之前需要重启,避免出现以下报错: ERROR: An NVIDIA kernel module ‘nvidia-uvm‘ appears to already be loaded in your kernel

reboot

ERROR: An NVIDIA kernel module ‘nvidia-uvm‘ appears to already be loaded in your kernel_an nvidia kernel module 'nvidia-uvm' appears to al-CSDN博客

选择  Continue install

如果出现build kernel Error类错误,请注意GCC版本,535以上的驱动,需要12.X的GCC

ERROR: An error occurred while performing the step: “Building kernel modules“. See /var/log/nvidia-i-CSDN博客

Driver install fails with the error [An error occurred while performing the step: "building kernel modules". See /var/log/nvidia-installer.log...] - Linux - NVIDIA Developer Forums

ubuntu系统查看gcc版本及版本切换_ubuntu查看gcc版本-CSDN博客

32bit  (NO)

Would you like to register the kernel module sources with DKMS? This will allow DKMS to automatically build a new module, if your kernel changes later. (NO)

 Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver will be used when you restart X?  Any pre-existing X configuration file will be backed  up.   (Yes)

奇怪问题汇总

The initramfs will likely need to be rebuilt due to the following condition(s):                           
  * Nouveau is present in the initramfs.              
  Would you like to rebuild the initramfs? 

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值