This script was designed in order to ease the installation process of Ubuntu server. It was designed to create an answer file that can be used to setup initial users, disks using Logical Volume Manager (LVM), and patches with minimal user interaction.
- Download and Run CreateSeedISOwDocker.sh
- FIRST RUN ONLY - The script will prompt to download any missing packages that are required, if they are not already installed on your Linux system
- FIRST RUN ONLY - Select all of the defaults (Default settings appear inside square brackets - [ ] )
- FIRST RUN ONLY - When prompted to build the ISO file at the end, say "no"
- The script when ran will auto generate a directory named /home/<user>/www, and an environment variable file /home/<user>/www/seed.env
- /home/<user>/www/ - is the directory that stores the data that is used to create the seed-<servername>.iso file
- /home/<user>/www/seed.env - is a file that contains default variables that can be modified for future seed-<servername>.iso file creations, or simply re-used
NOTE: It is strongly recommended that you modify/change the variable AnsibleHASH=''
from the default in /home/<user>/www/seed.env, by running the following command:
read PASS;openssl passwd -6 $PASS
- Copy the long list of characters starting with
$6$ ... and paste it in the variable field for `AnsibleHash='\$6\$...'` in the /home/<user>/seed.env file. - Add forward slashes in front of any dollar signs that are in the string of characters, and surround the string with single quotes
- Adding an SSH Key for Ansible
- Generate an SSH key pair or copy the contents from /home/<user>/.ssh/id_rsa.pub for an existing ansible account
ssh-keygen
- Add the contents from /home/<user>/.ssh/id_rsa.pub to the `AnsibleSSHKEY=''` variable in the /home/<user>/www/seed.env file
- Surround the contents with single quotes
- Username: myuser
- Password: Whatever you type in, when prompted
- Username: ansible
- Password: ChangeMe
- NOTE: The ansible user is the only one setup with sudo permissions, and the root password is not set.
- Docker and Docker Compose are installed by default, unless you choose not to install it when running CreateSeedISOwDocker.sh
- Docker and Docker Compose installation script/files can be found under /DockerInstall/ once installation is complete
- NOTE: The Docker install script will reboot the system
- Docker Compose files can be found under /docker-services/<DockerApp>
- Download latest Ubuntu Server: https://ubuntu.com/download/server
- Download WinSCP: https://winscp.net/download/WinSCP-5.19.5-Setup.exe
- Tool used for transferring files between linux host (where CreateSeedISOwDocker.sh script is ran) and a Windows host where the virtual environment might be located. (e.g. VirtualBox, VMware Workstation Player, VMware Workstation, or others)
- When building the virtual machine using the seed-<servername>.iso file it requires you to have two (2) CD/DVD drives.
- CD/DVD drive 1: UbuntuServer.iso
- CD/DVD drive 2: seed-<servername>.iso
- Boot the server
- At the prompt to continue using autoinstall, type 'yes' and press enter
- The server should then continue to be setup per the answer file, and will reboot
- After the reboot, it should come up and you should be able to login to it with the username that you created when running the CreateSeedISOwDocker.sh scipt or the ansible account.
- If the system does not boot the first time, switch the ISO files in the CD/DVD drives
- If you are unable to login to the server after the reboot, you will need to enter single user mode:
- Reboot the server
- Press 'ESC' quickly as the server reboots (You may need to press it multiple times)
- At the Ubuntu GRUB menu, press 'e' to edit the GRUB Boot options
- Scroll through the list until you find a line starting with 'linux' and is indented
- Goto the end of that 'linux' line, add a space and enter 'init=/bin/bash'
- Press F10 to continue booting the system into single user mode
- At the root prompt enter the following:
- mount -o remount,rw /
- passwd root
- Input a password for the root account, and confirm it, by entering the same password again
- reboot -f
- Once the server comes back up, login as the root account, with the password that you just setup.
- You will then need to manually re-create the new user and ansible accounts that were suppose to be added via the answer file
- You should also manually re-run the /DockerInstall/DockerInstall.sh script to install Docker/Docker Compose. NOTE: this script WILL reboot the server
To create a new seed.iso file:
- Create a www directory under your home: mkdir /home/$USER/www
- Create an empty meta-data file under www: touch /home/$USER/www/meta-data
- Install 'cloud-image-utils': apt install cloud-image-utils -y
- Run the following command: rm -rf /home/$USER/www/seed.iso; cloud-localds /home/$USER/www/seed.iso /home/$USER/www/user-data /home/$USER/www/meta-data
Current user for testing is: ubuntu
Current password hash is: ubuntu