码迷,mamicode.com
首页 > 系统相关 > 详细

Linux 篇 | Ubutu1804系统的基本配置

时间:2019-06-20 00:58:57      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:follow   原来   ios   get   nsx   配置   阿里   alived   roo   

Ubutu1804系统的基本配置

安装好Ubuntu系统后,可使用下面的配置优化系统

1.修改root用户的密码

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

2.修改配置,使root用户可以远程登录和开机可以使用root登录

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:~#

以上配置生效,需重启系统

3.修改Ubuntu的apt源

1.打开阿里云的Ubuntu源

https://opsx.alibaba.com/mirror

2.找到Ubuntu那一行,点击后面的“帮助”

3.根据上面的提示,打开“/etc/apt/sources.list”文件

  • 把文件里默认的配置都清除
vi /etc/apt/sources.list

4.选择Ubuntu的版本,然后复制apt源的配置,如ubuntu 18.04(bionic) 配置如下:

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.更新apt源

apt-get update

6.更新apt源后,就可以用apt-get安装软件了

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

输入“y”,确认安装

4.修改主机名

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

2.使主机名生效
reboot

5.修改默认ubuntu的网卡名称为“eth”格式

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.重启系统生效

Linux 篇 | Ubutu1804系统的基本配置

标签:follow   原来   ios   get   nsx   配置   阿里   alived   roo   

原文地址:https://blog.51cto.com/13465487/2411269

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!