VERDVANA'S BLOG Verdvana

Linux配置指南


1 前言

       


2 将shell环境由bash改为csh

        Linux默认的shell环境为bash,相应的环境变量配置文件为“~/.bashrc”。感觉bash没有tcsh好使,所以通过以下命令转换:

su      #获得root权限

        输入密码之后进行环境转换:

usermod -s /bin/tcsh <usrname>

        如需转回bash,执行如下命令:

usermod -s /bin/bash <usrname>

        重启生效。

        通过如下命令查看shell环境类型:

echo $SHELL

3 更换国内源

3.1 Ubuntu

        备份源:

sudo cp /etc/apt/sources.list /etc/apt/sources.bak.list

        打开源列表文件:

sudo gvim /etc/apt/sources.list

        在sources.list下添加如下源:

#阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb 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 main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

#网易源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

#清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

##中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

        保存退出后更新:

sudo apt-get update

3.2 SUSE

        首先禁用默认源:

sudo zypper mr -da

        添加阿里源:

sudo zypper ar -fc https://mirrors.aliyun.com/opensuse/distribution/leap/15.2/repo/oss openSUSE-Aliyun-OSS

sudo zypper ar -fc https://mirrors.aliyun.com/opensuse/distribution/leap/15.2/repo/non-oss openSUSE-Aliyun-NON-OSS

sudo zypper ar -fc https://mirrors.aliyun.com/opensuse/update/leap/15.2/oss openSUSE-Aliyun-UPDATE-OSS

sudo zypper ar -fc https://mirrors.aliyun.com/opensuse/update/leap/15.2/non-oss openSUSE-Aliyun-UPDATE-NON-OSS

        添加中科大源:

sudo zypper ar -fcg https://mirrors.ustc.edu.cn/opensuse/distribution/leap/15.2/repo/oss USTC:15.2:OSS

sudo zypper ar -fcg https://mirrors.ustc.edu.cn/opensuse/distribution/leap/15.2/repo/non-oss USTC:15.2:NON-OSS

sudo zypper ar -fcg https://mirrors.ustc.edu.cn/opensuse/update/leap/15.2/oss USTC:15.2:UPDATE-OSS

sudo zypper ar -fcg https://mirrors.ustc.edu.cn/opensuse/update/leap/15.2/non-oss USTC:15.2:UPDATE-NON-OSS

        添加清华源:

sudo zypper ar -fcg https://mirrors.tuna.tsinghua.edu.cn/packman/suse/openSUSE_Leap_15.2/ TUNA:15.2:PACKMAN

        添加北外源:

sudo zypper ar -fcg https://mirrors.bfsu.edu.cn/opensuse/distribution/leap/15.2/repo/oss/ OSS

sudo zypper ar -fcg https://mirrors.bfsu.edu.cn/opensuse/distribution/leap/15.2/repo/non-oss/ NON-OSS

sudo zypper ar -fcg https://mirrors.bfsu.edu.cn/opensuse/update/leap/15.2/oss/ UPDATE-OSS

sudo zypper ar -fcg https://mirrors.bfsu.edu.cn/opensuse/update/leap/15.2/non-oss/ UPDATE-NON-OSS

        之后更新软件源:

sudo zypper ref

4 安装net-tools

        有的发行版默认没有net-tools,无法方便地查看网卡信息等。

4.1 SUSE

sudo zypper install net-tools-deprecated

5 安装VMWare Tools

        在VMWare最上面的“虚拟机”菜单栏里点击“重新安装VMWare Tools(T)…”, 如果按钮是灰色,先要去设置里把“CD/DVD”的连接改为“使用物理驱动器”:

img1

        然后在重启虚拟机就可以点了。

        在虚拟机的光驱里找到VMWare Tools虚拟光盘,在里面有一个压缩包,复制到“/tmp”,然后解压:

tar zxpf /tmp/VMwareTools-x.x.x-yyyy.tar.gz

        进入解压出来的文件夹内,用管理员身份运行脚本:

sudo ./vmware-install.pl

        一路回车默认选项,中间可能会遇到无法找到路径的错误:

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?

        这时候新建几个文件夹:

sudo mkdir -p /etc/rc.d/rc0.d 
sudo mkdir -p /etc/rc.d/rc1.d 
sudo mkdir -p /etc/rc.d/rc2.d 
sudo mkdir -p /etc/rc.d/rc3.d 
sudo mkdir -p /etc/rc.d/rc4.d 
sudo mkdir -p /etc/rc.d/rc5.d 
sudo mkdir -p /etc/rc.d/rc6.d 

        再继续回车选择默认选项即可。


        告辞。