Ubuntu 安装源及初始配置

一、 配置常用 Ubuntu 安装的阿里源:

% <span class="token builtin class-name">cd</span> /etc/apt % <span class="token function">sudo</span> <span class="token function">vi</span> sources.list % <span class="token function">sudo</span> <span class="token function">apt</span> update 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-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports 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/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
% <span class="token builtin class-name">cd</span> /etc/apt % <span class="token function">sudo</span> <span class="token function">vi</span> sources.list  % <span class="token function">sudo</span> <span class="token function">apt</span> update  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-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports 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/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse  deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse 
% cd /etc/apt % sudo vi sources.list % sudo apt update 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-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports 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/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse

二、安装以下常用工具

  1. 安装 ssh,ifconfig 等常用网络软件
% <span class="token function">sudo</span> <span class="token function">apt</span> <span class="token function">install</span> net-tools <span class="token function">ssh</span>
% <span class="token function">sudo</span> <span class="token function">apt</span> <span class="token function">install</span> net-tools <span class="token function">ssh</span> 
% sudo apt install net-tools ssh
  1. 安装 gcc 等常用开发库
% <span class="token function">sudo</span> <span class="token function">apt</span> <span class="token function">install</span> build-essential
% <span class="token function">sudo</span> <span class="token function">apt</span> <span class="token function">install</span> build-essential 
% sudo apt install build-essential

三、常用配置命令

  1. 添加用户及设置
% <span class="token function">useradd</span> <span class="token punctuation">[</span>用户名<span class="token punctuation">]</span> % <span class="token function">sudo</span> <span class="token function">vi</span> /etc/group % <span class="token function">sudo</span> <span class="token function">vi</span> /etc/sudoers %sudo <span class="token assign-left variable">ALL</span><span class="token operator">=</span><span class="token punctuation">(</span>ALL:ALL<span class="token punctuation">)</span> NOPASSWD:ALL <span class="token punctuation">[</span>用户名<span class="token punctuation">]</span> <span class="token assign-left variable">ALL</span><span class="token operator">=</span><span class="token punctuation">(</span>ALL:ALL<span class="token punctuation">)</span> NOPASSWD:ALL
% <span class="token function">useradd</span> <span class="token punctuation">[</span>用户名<span class="token punctuation">]</span> % <span class="token function">sudo</span> <span class="token function">vi</span> /etc/group  % <span class="token function">sudo</span> <span class="token function">vi</span> /etc/sudoers  %sudo <span class="token assign-left variable">ALL</span><span class="token operator">=</span><span class="token punctuation">(</span>ALL:ALL<span class="token punctuation">)</span> NOPASSWD:ALL <span class="token punctuation">[</span>用户名<span class="token punctuation">]</span> <span class="token assign-left variable">ALL</span><span class="token operator">=</span><span class="token punctuation">(</span>ALL:ALL<span class="token punctuation">)</span> NOPASSWD:ALL 
% useradd [用户名] % sudo vi /etc/group % sudo vi /etc/sudoers %sudo ALL=(ALL:ALL) NOPASSWD:ALL [用户名] ALL=(ALL:ALL) NOPASSWD:ALL
  1. 设置远程操作
% <span class="token function">sudo</span> systemctl set-default multi-user.target % <span class="token function">sudo</span> systemctl set-default graphical.target
 % <span class="token function">sudo</span> systemctl set-default multi-user.target  % <span class="token function">sudo</span> systemctl set-default graphical.target 
% sudo systemctl set-default multi-user.target % sudo systemctl set-default graphical.target

2.1 合上笔记本盖子不休眠,取消 #HandleLidSwitch=suspend注释(即删除#号),然后将suspend改为ignore:

% <span class="token function">sudo</span> <span class="token function">vi</span> /etc/systemd/logind.conf <span class="token assign-left variable">HandleLidSwitch</span><span class="token operator">=</span>ignore
% <span class="token function">sudo</span> <span class="token function">vi</span> /etc/systemd/logind.conf <span class="token assign-left variable">HandleLidSwitch</span><span class="token operator">=</span>ignore 
% sudo vi /etc/systemd/logind.conf HandleLidSwitch=ignore

重启服务:

% <span class="token function">sudo</span> <span class="token function">service</span> systemd-logind restart
% <span class="token function">sudo</span> <span class="token function">service</span> systemd-logind restart 
% sudo service systemd-logind restart

2.2 安装远程 vnc

% <span class="token function">sudo</span> <span class="token function">apt</span> <span class="token function">install</span> vino dconf-editor
% <span class="token function">sudo</span> <span class="token function">apt</span> <span class="token function">install</span> vino dconf-editor     
% sudo apt install vino dconf-editor
% gsettings <span class="token builtin class-name">set</span> org.gnome.desktop.interface enable-animations <span class="token boolean">false</span>
% gsettings <span class="token builtin class-name">set</span> org.gnome.desktop.interface enable-animations <span class="token boolean">false</span> 
% gsettings set org.gnome.desktop.interface enable-animations false
  1. GPU 显示器安装

Nvidia GPU 安装

% <span class="token function">sudo</span> ./NVIDIA-Linux-x86_64-510.85.02.run <span class="token parameter variable">-z</span> <span class="token parameter variable">--dkms</span> --no-opengl-files --no-cc-version-check
% <span class="token function">sudo</span> ./NVIDIA-Linux-x86_64-510.85.02.run <span class="token parameter variable">-z</span> <span class="token parameter variable">--dkms</span> --no-opengl-files --no-cc-version-check 
% sudo ./NVIDIA-Linux-x86_64-510.85.02.run -z --dkms --no-opengl-files --no-cc-version-check

原文链接:https://blog.csdn.net/weixin_45750721/article/details/128694231

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享