Difference between revisions of "Installation (Ubuntu)"

Jump to navigation Jump to search
m
m (→‎Change IP Address: Minor update ifconfig)
 
(16 intermediate revisions by the same user not shown)
Line 87: Line 87:
=== Enable Root ===
=== Enable Root ===
# Use the command <code> sudo passwd root </code>
# Use the command <code> sudo passwd root </code>
# Enter your user password
# Enter a strong password for the root account
For Ubuntu 18...
# Use the command <code> sudo passwd</code>
# Enter your user password
# Enter your user password
# Enter a strong password for the root account
# Enter a strong password for the root account
Line 104: Line 109:
#* <code> mdadm --misc -D /dev/md1 </code>
#* <code> mdadm --misc -D /dev/md1 </code>


== Change IP Address ==
== Change IP Address (Pre v18) ==
=== v8 Hardy Heron / v10 Lucid Lynx ===
* Edit the <code> /etc/network/interfaces </code> file in the following fashion to set static address details
* Edit the <code> /etc/network/interfaces </code> file in the following fashion to set static address details
<pre>
<pre>
Line 126: Line 132:
  domain domain.com
  domain domain.com
  search domain.com
  search domain.com
  search anotherdomain.com
  search domain.com


* Then restart networking
* Then restart networking
** v8 and v10: <code> /etc/init.d/networking restart </code>
** <code> /etc/init.d/networking restart </code>
** v12: <code> service networking restart </code>


* Confirm network config is as expected with
* Confirm network config is as expected with
** <code>ifconfig</code>
** <code>ifconfig</code>
=== v12 Precise Pangolin ===
* Edit the <code> /etc/network/interfaces </code> file in the following fashion to set static address details
<pre>
# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.1.150
        netmask 255.255.255.0
        gateway 192.168.1.1
dns-nameservers 192.168.1.20 8.8.8.8
dns-domain localdomain.com
dns-search localdomain.com anotherdomain.com
       
</pre>
* Then check the local hosts file <code>/etc/hosts</code>, so that the IP v4 part looks like this (so the host can resolve itself)...
<pre>
127.0.0.1      localhost
192.168.1.150  hostname.domain.com  hostname
</pre>
* Then restart networking
** <code> service networking restart </code>
* Confirm network interface config is as expected with
** <code>ifconfig</code>
* Confirm DNS config is as expected with
** <code>less /etc/resolv.conf</code>
=== Persistent Route ===
To add a persistent route to an interface, add using the following syntax (example sends traffic to 172.32.1.0/24 via eth1 to 192.168.1.100
up route add -net 172.32.1.0/24 gw 192.168.1.100 dev eth1
=== Additional IPs / Multihome ===
To add additional IP addresses to an interface, create sub-interfaces as below.
<pre>
auto eth0:1
auto eth0:2
# Sub 1
iface eth0:1 inet static
    address 192.168.1.160
    netmask 255.255.255.0
# Sub 2
iface eth0:2 inet static
    address 192.168.1.161
    netmask 255.255.255.0
</pre>
'''RTNETLINK answers: File exists''' - Note that you can't use the same default gateway twice, doing so will cause this error
== Change IP Address (v18 onwards) ==
Ubuntu now uses [https://netplan.io Netplan], do not use the <code>/etc/network/interfaces</code> config file, use either <code>/etc/netplan/01-netcfg.yaml</code> or <code>/etc/netplan/50-cloud-init.yaml</code>. Formatting is very important with YAML files, indents especially.
# Find the interface name (eg <code>ens2</code>)
#* <code> ip link </code>
# Edit the <code>/etc/netplan/01-netcfg.yaml</code> config file as show below
# Apply the changes
#* <code> netplan apply</code>
<pre>
network:
  version: 2
  renderer: networkd
  ethernets:
    ens2:
      dhcp4: no
      addresses:
        - 192.168.1.50/24
      gateway4: 192.168.1.1
      nameservers:
          addresses: [192.168.1.1,8.8.8.8]
</pre>
=== Persistent Route ===
To add a persistent route to an interface, add using the following syntax (example sends traffic to 172.32.1.0/24 via eth1 to 192.168.2.100) to add the <code>routes</code> config to the interface the traffic should go through.
<pre>
    ens2:
      addresses:
        - 192.168.2.50/24
      dhcp4: no
      routes:
        - to: 172.32.1.0/24
          via: 192.168.2.100
</pre>


== Update the OS ==  
== Update the OS ==  
Line 141: Line 236:
#* <code> apt-get upgrade </code>
#* <code> apt-get upgrade </code>
#* If updates are being held back (eg linux image), then use <code> aptitude safe-upgrade</code>
#* If updates are being held back (eg linux image), then use <code> aptitude safe-upgrade</code>
# If running in VMware VM, [[VM Tools_Install_(Ubuntu)|install VM Tools]]


== Install VM Tools ==
=== Remove Old Version ===
The pre-built modules that come with the VMTools installer aren't compatible, therefore the script needs to be able to compile them, however the required library files aren't available by default, so the procedure is a little laboured.
Old kernel images will tend to linger in <code>/boot</code> and source code will remain in <code>/user/src</code>.  These can be safely removed so long as you're completely certain which you are using (normally the latest)
# Get the versions currently installed
#* <code>dpkg --get-selections | grep linux-image</code>
# Remove unwanted versions (don't remove the current or base/unversioned image)
#* EG <code>apt-get purge linux-image-3.2.0-32-virtual </code>
#* If you've got lots to remove its easier to do lots in one go
#** EG <code> apt-get purge linux-image-3.2.0-51-virtual linux-image-3.2.0-52-virtual </code>


=== Ubuntu 8.04 LTS ===
To remove old source, just delete manually,
# Install the build library files...
* EG <code> rm -fr /usr/src/linux-headers-3.2.0-51 </code>
#* <code> apt-get install build-essential </code>
#* <code> apt-get install linux-headers-2.6.24-26-server </code>
#** Use <code> uname -r </code> to get the right headers version number
# Select "Install VM Tools" from the VI Client
# Mount the VM Tools CD-ROM
#* <code> mount /media/cdrom0/ </code>
# Copy to home directory
#* <code> cp /media/cdrom/VMwareTools-4.0.0-219382.tar.gz /home/user/ </code>
# Uncompress and then move into the <code> vmware-tools-distrib </code> directory
#* <code> tar xf VMwareTools-4.0.0-219382.tar.gz </code>
#* <code> cd vmware-tools-distrib </code>
# Run the install script
#* <code> ./vmware-install.pl  </code>
# Restart
#* <code> shutdown -r now </code>
 
=== Ubuntu 10.04 LTS ===
VM Tools can be installed via two methods, neither of which is ideal...
* Using the normal VM Tools ''CD'' - requires additional library install and sometimes mounting the CDROM doesn't work too well.
* Using APT package manager - doesn't work quite as well as it could (upgrading VM Tools isn't supported), and support for this method is rumoured to be dropped in future releases
 
==== VM Tools ''CD''====
# Install the build library files...
#* <code> apt-get install build-essential </code>
# Select "Install VM Tools" from the VI Client
# Mount the VM Tools CD-ROM
#* <code> mount /dev/cdrom /media/cdrom/ </code>
#* If unable to mount, see [[Troubleshooting_(Ubuntu)#Unable_to_Mount_CD-ROM|Unable to Mount CD-ROM]], ''mounting read-only'' is expected
# Copy to tmp directory (version number below will vary)
#* <code> cp /media/cdrom/VMwareTools-4.0.0-236512.tar.gz /tmp/ </code>
# Unmount the CD-ROM, and move into tmp directory
#* <code> umount /media/cdrom/ </code>
#* <code> cd /tmp/ </code>
# Uncompress and then move into the <code> vmware-tools-distrib </code> directory
#* <code> tar xzvf VMware*.gz </code>
#* <code> cd vmware-tools-distrib </code>/
# Run the install script, and accept defaults
#* <code> ./vmware-install.pl  </code>
# Restart (not actually required, but I tend to on a new install to be sure that VMtools start properly following a bounce)
#* <code> shutdown -r now </code>
 
==== APT Package Manager ====
# Install VM Tools using apt package manager
# Open VMware Packaging Public GPG Key at http://packages.vmware.com/tools/VMWARE-PACKAGING-GPG-KEY.pub
# On the server open a new file called <code>VMWARE-PACKAGING-GPG-KEY.pub</code> with the <code>/tmp</code> directory
# Copy and paste the contents of the webpage into the file and save
# Import the key using the following command
#* <code>apt-key add /tmp/VMWARE-PACKAGING-GPG-KEY.pub</code>
#* You should get <code>OK</code> returned
# If you need to add a proxy see http://communities.vmware.com/servlet/JiveServlet/download/1554533-39836/Vmware%20Tools%20Guide%20Linux%20osp_install_guide.pdf
# Open a new vi in VI called <code>/etc/apt/sources.list.d/vmware-tools.list</code>
# Add the following line
#* <code> deb http://packages.vmware.com/tools/esx/<esx-version>/ubuntu lucid main restricted </code> where <esx-version> is the appropriate esx version found at http://packages.vmware.com/tools/esx/index.html
# Update the repository cache
#* <code> apt-get update </code>
# Install VM Tools
#* <code> apt-get install vmware-tools </code>


== NTP ==
== NTP ==
Line 220: Line 265:
#* <code> server 3.europe.pool.ntp.org </code>
#* <code> server 3.europe.pool.ntp.org </code>
# Restart the NTP service
# Restart the NTP service
#* <code> service ntp restart </code>
#* <code> systemctl restart ntp </code>
# Verify using the following commands
# Verify using the following commands
#* <code> ntpq -np </code>
#* <code> ntpq -np </code>

Navigation menu