ubuntu-18.04 的环境初始化配置
Posted VicLiu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntu-18.04 的环境初始化配置相关的知识,希望对你有一定的参考价值。
ubuntu各版本阿里云iso镜像下载地址
ubuntu 14.04:
http://mirrors.aliyun.com/ubuntu-releases/14.04/
ubuntu 16.04:
http://mirrors.aliyun.com/ubuntu-releases/16.04/
ubuntu 18.04:
http://mirrors.aliyun.com/ubuntu-releases/18.04/
其他链接
官方下载地址(不推荐)
https://www.ubuntu.com/download
中科大源
http://mirrors.ustc.edu.cn/ubuntu-releases/16.04/
阿里云开源镜像站
http://mirrors.aliyun.com/ubuntu-releases/16.04/
兰州大学开源镜像站
http://mirror.lzu.edu.cn/ubuntu-releases/16.04/
北京理工大学开源
http://mirror.bit.edu.cn/ubuntu-releases/16.04/
浙江大学
http://mirrors.zju.edu.cn/ubuntu-releases/16.04/
不知名镜像网站
http://mirror.pnl.gov/releases/xenial/
各个版本下载网址:
http://mirrors.melbourne.co.uk/ubuntu-releases/
1.配置网卡ip
1)配置网卡eth0,本地内网网卡无需指定网关和域名服务器
root@ubuntu1804:~# vim /etc/netplan/01-netcfg.yaml network: version: 2 renderer: networkd ethernets: eth0: dhcp4: no addresses: [192.168.1.30/24]
2)配置网卡eth1,要保持严格缩进,否则会导致网卡起不来
root@ubuntu1804:~# vim /etc/netplan/02-netcfg.yaml network: version: 2 renderer: networkd ethernets: eth1: dhcp4: yes addresses: [192.168.10.107/24] gateway4: 192.168.10.1 nameservers: addresses: [223.6.6.6]
2.修改网卡名为eth*
1)编辑grub文件
root@ubuntu1804:~#vim /etc/default/grub …… GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0" ……
2)加载更新grub文件
root@ubuntu1804:~#update-grub
3)重启机器实现网卡名更改
root@ubuntu1804:~#reboot
4)启动机器实现网卡名的修改
若要再次修改网卡ip,修改完后需重启网络
root@ubuntu1804:~#netplan apply #重启网卡命令
3.配置为国内阿里云仓库源
1)配置ubuntu仓库源
root@ubuntu1804:~# vim /etc/apt/sources.list 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
2)更新仓库
root@ubuntu1804:~# apt update Get:1 http://mirrors.aliyun.com/ubuntu bionic InRelease [242 kB] Get:2 http://mirrors.aliyun.com/ubuntu bionic-security InRelease [88.7 kB] Get:3 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease [88.7 kB] Get:4 http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease [242 kB] ……
3)升级本机所有已安装的软件包
root@ubuntu1804:~# apt upgrade
4.安装初始化常用的软件包
1)在ubuntu18.04中常用的初始化安装包
root@ubuntu1804:~# apt-get install iproute2 ntpdate tcpdump telnet traceroute nfs-kernel-server nfs-common lrzsz tree openssl libssl-dev libpcre3 libpcre3-dev zlib1g-dev gcc openssh-server iotop unzip zip ipmitool -y
2)在centos7的初始化最小化安装常用软件包
[root@centos7 ~]# yum install vim iotop bc gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel zip unzip zlib-devel net-tools lrzsz tree ntpdate telnet lsof tcpdump wget libevent libevent-devel bc systemd-devel bash-completion traceroute -y
5.开启远程连接并允许root账户直接登录
1)编辑ssh远程服务配置文件,注释掉禁止root秘钥登录
root@ubuntu1804:~# vim /etc/ssh/sshd_config
2)再重新启动sshd服务,即可实现直接以root身份登录虚拟机或root远程登录
root@ubuntu1804:~# systemctl restart sshd
以上是关于ubuntu-18.04 的环境初始化配置的主要内容,如果未能解决你的问题,请参考以下文章
docker:ubuntu18.04 配置phalcon3.4环境
Ubuntu 18.04/20.04 CV环境配置(中):Tensorrt + Pytorch安装配置
Ubuntu 18.04/20.04 CV环境配置(中):Tensorrt + Pytorch安装配置