Installation and basic configuration of Ubuntu Server in virtual machine

Posted by xgab on Sat, 02 May 2020 01:00:12 +0200

Installation and basic configuration of Ubuntu Server in virtual machine

Install Ubuntu Server 16

The virtual machine uses VMware workstation. Create a new virtual machine. Next, install ubuntu. There is an error.

The language was changed to English, no error was reported, and the installation was successful.

configure network

In order to facilitate the use of ssh, the NAT network with dhcp off is used, and static ip needs to be configured.

Use ifconfig to view the network card name.

root@ubuntu:~# ifconfig -a

Set ip:

root@ubuntu:~# nano /etc/network/interfaces

Add the following:

#Network card name ens33
auto ens33
iface ens33 inet static
address 192.168.101.35
mask 255.255.255.0
gateway 192.168.101.2

Set dns:

root@ubuntu:~# nano /etc/resolvconf/resolv.conf.d/base

Add the following:

nameserver 192.168.101.2

Refresh cache, restart network:

root@ubuntu:~# resolvconf -u
root@ubuntu:~# service networking restart
root@ubuntu:~# sudo /etc/init.d/networking restart

Source change

The download speed of using foreign source is relatively slow, and Alibaba source can greatly improve the download speed.

Backup:

root@ubuntu:~# cp /etc/apt/sources.list /etc/apt/sources.list.bak

Source change:

Because the virtual machine environment is used, the text cannot be copied from the real machine, so the method of saving the nation by curve is used to change the source.

Prepare the sources.list file and add the following:

deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

Put sources.list in the root of the web server.

Delete the sources.list in the virtual machine and download the sources.list on the real machine:

root@ubuntu:~# cd /etc/apt
root@ubuntu:/etc/apt# rm sources.list
root@ubuntu:/etc/apt# wget 192.168.101.4/sources.list

Refresh cache:

root@ubuntu:~# apt-get update

Install ssh

root@ubuntu:~# apt-get install ssh

Here, the basic configuration is complete.

Topics: Linux Ubuntu network ssh Vmware