The basic configuration of the system Ubutu1804 | Linux articles

The basic configuration of the system Ubutu1804

After installing Ubuntu system, the following configuration may be used to optimize the system

1. Modify the root password

sudo passwd root
输入密码
再次输入密码

2. modify the configuration, the root user can log in and start using remote root login

sudo sed -i 's@mesg n || true@tty -s && mesg n || true@' /root/.profile

sudo sed -i 's@mesg n || true@tty -s && mesg n || true@' /root/.profile

验证:
查看/root/.profile文件是下面的样子就行

root@ubuntu1804:~# cat /root/.profile
# ~/.profile: executed by Bourne-compatible login shells.

if [ "$BASH" ]; then
  if [ -f ~/.bashrc ]; then
    . ~/.bashrc
  fi
fi

tty -s tty -s mesg n || true
root@ubuntu1804:~#

The above configuration takes effect, the need to reboot the system

3. Modify the Ubuntu apt source

1. Open source Ubuntu cloud Ali

https://opsx.alibaba.com/mirror

2. Locate the line that Ubuntu, click on the back of the "Help"

The above tips, open the "/etc/apt/sources.list" file

  • The default configuration files are cleared
vi /etc/apt/sources.list

4. Select Ubuntu version, then copy the configuration apt source, such as ubuntu 18.04 (bionic) configured as follows:

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-proposed main restricted universe multiverse
deb-src 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-backports main restricted universe multiverse

5. Update apt source

apt-get update

6. After the update apt source, you can use apt-get install the software

示例:安装haproxy和keepalived软件
apt-get install haproxy keepalived

输入“y”,确认安装

4. Modify the host name

1.修改主机名
vi /etc/hostname
主机名

2.使主机名生效
reboot

5. Modify the default ubuntu card name "eth" format

1.修改配置文件 vi /etc/default/grub

2.在GRUB_CMDLINE_LINUX添加内容
    GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

3.生效新的grub.cfg文件
    grub-mkconfig -o /boot/grub/grub.cfg

4.修改网卡配置文件的名称  
把原来的"ensxx" 改为 “ethxx”

5.重启系统生效

Guess you like

Origin blog.51cto.com/13465487/2411269