This document is designed to bring you up to speed on some Linux basics assuming little knowledge and also assuming the user is using a Windows machine. It is written with installing Workfront Agent in mind, but also contains general knowledge.
The Command Line
There are no GUIs on servers. Please see the General Tips section at the end of this document.
Key commands with flags to become familiar with are 'cd' (change directory -- to navigate the file system), 'rm' (remove/delete items), and 'mkdir' (make directory -- 'directory' is the Linux equivalent of Windows 'folder'). These and more can be found at the following links:
https://ubuntu.com/tutorials/command-line-for-beginners#1-overview
https://www.linuxjournal.com/content/linux-command-line-interface-introduction-guide
https://www.hostinger.co.uk/tutorials/linux-commands
A YouTube video here: MUST KNOW Linux Commands - YouTube
For more advanced information, refer to the following link: https://linuxcommand.org/tlcl.php
Sudo (Superuser do)
While working in the command line, you may find that you do not have the required privileges to do something. For example, you may enter a command like nano FileName.config only to be told with a prominent red warning that you do not have write privileges on FileName.config. This can be resolved by putting sudo before the rest of the command, so in our example this would be sudo nano FileName.config. You should then be prompted for the password for your current user. After entering this, assuming that user has the required privileges, you will then be able to do what you want with FileName.config.
Further reading can be found here: https://acloudguru.com/blog/engineering/linux-commands-for-beginners-sudo
Nano
Nano is a simple command line text editor included in most Linux distributions. The command to use it is:
> nano FileName.config
If you're already in the correct directory, or > nano The/Path/To/FileName.config if you're not. Once you've opened it, it works by using the shortcuts indicated at the bottom and the cursor keys.
Further reading can be found here: https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/
SSH (Secure Shell)
This is a network protocol, and the standard way to 'remote in' to Linux servers and control them via command line.
OpenSSH is a suite of programs based on SSH which is included in Windows 10+. This may need to be enabled on your Windows machines - see here for more details. Other SSH clients are also available for Windows. This is all included in Linux.
Example commands can be seen here:
> ssh qa@wander
The ssh here means 'use SSH'. 'qa' in this example is the username for the 'wander' server (an IPV test server).
After this command is executed, you will be prompted to provide a password. On successfully entering your password, you're then remoted onto the Linux machine and the command line will run on that machine.
Another example is:
> ssh -i "UbuntuLinuxInstancekey.pem" ubuntu@ec2-3-25-195-179.ap-southeast-2.compute.amazonaws.com
The ssh here means 'use SSH'. The '-i' flag means that what follows will be the authentication keys. "UbuntuLinuxInstancekey.pem" is the name of an authentication key file retrieved from AWS for the instance that was created to host Workflow Agent. Please note this command was run from Windows in its command line when it was already in the folder containing 'UbuntuLinuxInstancekey.pem'. 'ubuntu' is the name of the user at 'ec2-3-25-195-179.ap-southeast-2.compute.amazonaws.com'. As server authentication is provided by the key after running this command you would be 'remoted in' to the server in question with no further authentication required.
SMB (Secure Message Block)
A communication protocol for providing shared access to various things. This is useful for things like folder sharing - for example, temporarily sharing a folder containing Workflow Agent files you have on your Windows machine with the Linux server.
An example usage is as follows:
- Designate a folder to share from. In Windows, right-click the folder you want to share, then select Properties. From the Sharing tab, click Share. Select a user to share the folder with (TIP: usernames for sharing with Linux should not contain slashes. If the username contains slashes, it is recommended that you create a new one without.).
- Find your Windows hostname. To do this, open Terminal / CP / Powershell and use 'ipconfig' - your hostname will be one of the IPv4 addresses. If you're using a VM, the name of your machine should be used.
- In Windows, go to the Network and Sharing Centre. Go to 'Advanced sharing options' and enable all the file and discovery options. Go to Windows Features and enable all of the SMB options.
- Use SSH to remotely access your Linux box. Install SMB/CIFS support: > sudo apt-get install cifs-utils
- Make a mount point somewhere: > sudo mkdir NameDirectoryToMountStep5
- Without moving away from the folder where the mount point NameDirectoryToMountStep5 was created run this command to mount the shared disk onto this point:
> sudo mount -t cifs //WindowsHostnamefromStep2/NameofDesignatedShareFolderStep1 NameDirectoryToMountStep5 -o user=WindowsAuthorisedFolderUserStep1Here.
After running this, you may be prompted for two passwords - the Linux and Windows users. After entering both of these, the folder should be successfully shared. - Confirm the folders / directory are shared. Navigate to these and check that you can see the files.
Wget (GNU Wget)
'Wget' is a way to retrieve content from web servers. Please note this is not a form of 'shared folder' as described above but a way of downloading those files directly. For example you may have Workflow Agent in a Dropbox account and want to get those files to the Linux server for installation. Wget should already be included in Ubuntu Server, if it is not this command will get it (after 'remoting in' to the Linux server):
> sudo apt install wget
An example usage is as follows:
- 'Remote in' to the server you want to download the files to. See 'SSH' section above. .
- If you wish create a folder for the downloaded files you can use this command: > sudo mkdir NameDirectoryToPutFilesIn
- Navigate to where you want the files to go.
- In your browser go to the file in Dropbox you want. You need the download link.
- You should now have a URL copied. Change the 'dl=0' at the end to 'dl=1'. It should look something like this: https://www.dropbox.com/sh//xyzxyzxyzxyzyzxyyxzyxyzxyycyzyxycyzyxyyyzxyzya?dl=1
- Back to the Linux server, you should be in the directory you want this files to go.
- Use a command like this: > sudo wget https://www.dropbox.com/sh/xyzxyzxyzxyzyzxyyxzyxyzxyycyzyxycyzyxyyyzxyzya?dl=1
- The files should start transferring.
For further reading and usage try here.
Docker
Docker allows applications to run in 'containers' - these are loosely isolated environments regardless of the underlying OS. These containers have everything a particular application needs. An issue with software development is dependencies - the things a particular application needs to work. An application can work on one machine, for example where it was developed, but not on another, for example a QA machine, because the things it needs in order to work are different or don't exist on that machine. Having applications run in containers helps solve this issue because these are independent environments and are also highly portable. Containers also differ from virtual machines because they don't include a guest OS.
This a brief overview, but Docker containers are becoming an increasingly important part of software development because they make the process more efficient. Typically we expect Workflow Agent to run in a Docker container on a Linux machine, which is why it is mentioned here.
General Tips
The 'Tree' utility displays the file structure in a depth-indented way, which is useful when browsing through directories containing a lot of sub-directories. You can get it with this command: sudo apt install tree. Following that, just type 'tree' and press Enter. You will be shown the file structure from your current location downwards.
While in the command line, click tab to give you available options and to complete if there is only one option. For example, if you type cd a then tab, either all the directories starting with the letter a will be shown, or, if there is only one directory starting with the letter a, its full name will be displayed.
While in the command line, clicking the up or down arrow keys will show previously entered commands. You can then edit these if needed before executing the command with Enter.
Windows Powershell or Command Prompt will allow you to SSH into a Linux server adequately. Windows Terminal is (at the time of writing) a fairly new terminal program from Microsoft. However, a dedicated SSH client like Putty will likely be better for more advanced use. Visual Studio Code includes a Terminal below the the text editor which is useful.