- Continuous Integration,Delivery,and Deployment
- Sander Rossel
- 1605字
- 2021-07-02 15:42:11
Installing Ubuntu
When you start your VM for the first time, VirtualBox will ask for a startup disk. The startup disk should install our operating system, but we don't have one yet. Head over to https://www.ubuntu.com/ and find the server download. At the time of writing this, I downloaded Ubuntu Server 16.04.1 LTS (Long Term Support). The default download should be an iso file.
Once you have downloaded the Ubuntu iso file, start the VM. When it asks for the startup disk, you can browse your computer and select the Ubuntu iso file. Once it is selected, click Next and the installation will begin.

When you select the iso file and restart your VM, it will now take you to the installer again and you can follow the steps as explained.
First, you have to choose the language (you can navigate using the up and down arrow keys and select using the Enter/return key; use the left and right arrow keys to select <Go back>). I have chosen English and I suggest you do too, so you can follow along with the tutorial (and the rest of the book) without translating everything. In the menu that follows, pick the top option, Install Ubuntu Server. Next, you have to pick a language for your installation. Again, I picked English. The next step is to pick your location, which will, among other things, determine your time zone. I've actually picked The Netherlands here and I suggest you look for your own location as well. If you are lucky, you will be taken to the keyboard configuration. However, if, like me, you picked a language that is not spoken in your location (and we don't speak English in the Netherlands) or your locale is not preinstalled, you will be prompted to pick a locale first. I have picked United States (en_US.UTF-8).
So, next up is the keyboard layout. I recommend following the automatic keyboard detection, unless you know your keyboard layout (there are loads of them).
After you have determined your keyboard layout, you will see some progress bars. After that, you need to specify a host name. Again, I picked ciserver (no spaces or capitals this time). Next, you are prompted for your real name (Sander Rossel), and after that, you can make up a username (sander). After that, pick a password (1234 or whatever; you will only use this on your local computer anyway). Re-enter the password. If your password is a weak password (like 1234), the next question will be if you are sure that you want to use this weak password. Next, do not encrypt your home directory. You can just accept the chosen time zone. For your disk partition, choose the default, Guided - use entire disk and set up LVM. An LVM is a Logical Volume and allows you to dynamically create, resize, or delete partitions. After that, just choose Yes and Continue until a few more progress bars appear. Leave the HTTP proxy empty and continue. Also, do not install automatic updates. After that, the installation will prompt you to pick some software to install. Leave the standard system utilities selected, but do not select any of the other software. We can always install other software manually later. After that, choose to install the GRUB boot loader.
Hooray, you have now successfully installed Ubuntu Server. The VM will now restart and you can log in with the credentials you chose during installation (for me, that is the username sander and the password 1234):

You will notice that Ubuntu gives you nothing more than a command line. We have just installed a server, and servers do not really need fancy user interfaces. User interfaces do come in handy, especially when you are not used to doing everything through a command. Luckily, Ubuntu does actually have a user interface (multiple actually); it is just not installed. In this book, I am not going to use the Ubuntu desktop, but if you want, you can install it by simply running the following commands:
sudo apt-get update
sudo apt-get install ubuntu-desktop
When the installation is done, you can restart either by using the reboot command or by using, poweroff command and then restarting from VirtualBox again.
If you are not familiar with Linux terminology, these terms are superuser do (sudo) (so you are running the commands as an administrator) and Advanced Packaging Tool (apt). apt-get update makes sure your packages source is up to date (it does not update packages!). You should run this before installing a package to make sure you install the most recent version. apt-get install some-package installs a package.
The next thing we will need to do is to make sure we can access our Ubuntu server running in the VM from our host. To do this, we first need to close our VM. After that, go to the settings of that VM and go to the Network tab. Select Adapter 2 and select the Enable Network Adapter box. After that, pick Host-only Adapter in the Attached to dropdown. Save your changes and start up the VM again. It gets a little tricky from here. Log in to your VM and execute the command ls /sys/class/net. This will list your available network devices. You should be seeing something like enp0s1 enp0s2 lo (the numbers of enp0s# may vary; I actually had 3 and 8). The next thing we need to do is add one of those enp0s#'s to your network settings. First though, open your VirtualBox preferences (under the File menu) and go to the Network settings. There, select the Host-only Networks tab and select the network you used for your VM's second adapter (there should be only one). Now check out the DHCP Server tab, specifically Lower Address Bound. You will need this IP address (or any IP address between the lower and upper bound). Mine was 192.168.56.101, so I suspect it will be the same for you. Now, edit your network settings in Ubuntu. To do this, open the /etc/network/interfaces file in vi; you can do this by executing the command sudo vi /etc/network/interfaces. Now, press I to edit and add the following lines to the file:
auto enp0s8
iface enp0s8 inet static
address 192.168.56.101
netmask 255.255.255.0
Once you have made the changes, hit Esc to stop editing and run :wq to exit and save (or :q! to exit without saving). Restart your VM again (using poweroff or reboot), log in to Ubuntu, and use the ifconfig command. If everything went well, you should now see your three network devices listed.
- auto enp0s8: Automatically brings up the enp0s8 device when Ubuntu boots
- iface enp0s8 inet static: Gives the enp0s8 network interface a static (as opposed to dynamic, or dhcp) IPv4 address (inet6 for IPv6)
- address: The actual IP address
- netmask: The netmask
- C/C++算法從菜鳥到達人
- Vue.js 3.0源碼解析(微課視頻版)
- Learning Linux Binary Analysis
- Monitoring Elasticsearch
- Access 2016數據庫管
- MongoDB權威指南(第3版)
- UML 基礎與 Rose 建模案例(第3版)
- Learning Vaadin 7(Second Edition)
- C語言程序設計教程
- Scala Data Analysis Cookbook
- 計算機應用基礎教程(Windows 7+Office 2010)
- Java Web應用開發給力起飛
- ASP.NET Web API Security Essentials
- Qt 4開發實踐
- Maven for Eclipse