The purpose of being a Linux Systems Administrator is to optimize, manage, and deploy system resources to serve and support applications and users.
------------
Basics
The four tools of any Linux system admin are logs, configurations, documentation, and the command line. Logs are system logs. Configurations are settings. Documentation are Standard Operating Procedures, and knowledge base sections that you look up. And the fourth tool is the command line.
-------
Installing Linux
Installing linux is surprisingly easy. Especially easy if you choose to use virtualbox for Windows, which is a free piece of software. I recommend using CentOS or Ubuntu to practice linu administration.
Whatever you do. If anyone suggests that you install gentoo: DON'T. JUST SIMPLY DON'T.
--------
Most common commands
The most common commands for linux would be the following:
-----------------------------
Keyboard commands for linux terminalControl+Z To kill a processes
Control+C to close a operation or command in progress.
-------------------------
Terminal and mouse movements:Fun fact, by simply highlighting the text, the terminal automatically copies the text you can use in another program.
By highlighting the text and click the right mouse button the text can get pasted. There is no cut function to my knowledge.
------------------------
The Terminal itself:
The terminal is a major part of Linux because most of your work as a sysadmin will typing commands and scripting commands as part of your duties.
It's often said that the terminal is the beating heart of the Linux OS. This section is to give you a basic understanding of how terminal commands work.
Linux by default uses BASH or Bourne-Again Shell, which is the shell program sh for UNIX.
UpArrow or DownArrow - Scroll through typed commands
Shift+PageUp or Shift+PageDown - Scroll up or down through shell output
Home or End - Move to the start or end of a line, respectively
Tab - Autocomplete a file name, directory name or command name.
Ctrl+c - End a running process
Ctrl+d - End-Of-File (EOF) character (usually ends a process or signifies the end of input data)
Ctrl+z - Send the currently running process to the background
Ctrl+l - Clear the screen, same as running the clear command
Common commands
pwd - Print Working Directory. Outputs the full path of the current directory.
cd - Change Directory. Used to switch to a different directory.
ls - List. Lists files and directories in the current directory.
ls -a Lists "hidden" files and directories also. Hidden files in linux are preceded with a full stop.
ls -l Lists further information about the files, including size, modify date, owner and permissions.
ls -t List by modify date, with the most recently modified files at the top.
cp - Copy a file/directory.
cp -r Descend into directories (recursively copy all directory contents).
mv - Move or rename a file.
rm - Delete a file.
rm -r Delete directory contents. (Never “rm -r /”! EVER)
chmod - Changes file permissions for the Owner, Group and Others.
chown - Changes the owner of a file.
chgrp - Changes the group of a file.
date - Display current date and time.
who - Displays a list of currently logged in users.
echo - Prints to stdout.
cat - Concatenates text to stdout.
grep - Searches for strings in a file or stdin.
su - Switch user. Defaults to root.
sudo - Similar to su but uses your own password instead. Lets you configure access in /etc/sudoers.
passwd - Change password. Defaults to current account.
rsync - Synchronizes files and directories.
halt - halt the system
!! - display last command
!3 - display third command
To truly understand the terminal is not memorize call the commands and options but rather in seeing the patterns and grasping the underlying concepts.
There two major commands to do administrative tasks: su and sudo.
su will ask for your password and give your root privileges for subsequent commands. sudo on the other hand will give you root privileges for a single command and prompt you to enter your password. Use your root privileges when needed. Using root privileges irresponsibly can harm your server.
------------------------------------------
LAMP Stack
LAMP is the foundation of Linux based servers. LAMP servers work great with Drupal and Wordpress. LAMP stands for the following
Linux - Foundation of a LAMP Stack Server
Apache - Webserver
MySQL - Details to be quared by scripting
PHP - Web app and PHP and python/perl
-------------
There are two ways to install a LAMP server. The First one is using taskel, and the second one is to install each component of the LAMP stack separately.
The taskel option
The first one is the taskel option, and it's done in three steps
sudo apt-get update
sudo apt-get install tasksel
And finally, sudo taskel - This step will give you a prompt check for the LAMP server and all you need to do is to select "OK"
Installing the LAMP Stack manually:
Installing the LAMP Stack manually is done via the following linux command line commands:
Installing Apache, mysql-server
sudo apt install apache 2
sudo apt install mysql-server
sudo apt install php pear php-fpm php-dev zi
sudo apt install php-curl php-xml rpc
Then, restart the server via sudo service apche2 restart (however the server will restoart automatically)
Check apache via https://localhost/ check php via two ways
1. executing any pp file from within /var/
or
2. php -r 'echo" "\n\n Your PHP installation is working fine \n\n \n"
--------------------
Linux User ID ranges:
0-99 System accounts such as root, sys, daemon, and binaries
100-60,000 – General purpose accounts for regular users
60,000-2,147,483,647 – Accounts that do not have full functionality such as anonymous users
------------------
Hard Links and Symbolic links
Hard Links and Symbolic links
Each file in linux has it's own inode. Inodes keep track of a files atrtibutes and its location on the disk. If you need to be able to refer to a single file usiong two serpate filenames, a hard link can be created.
A hard link will have the same inode as the original and will look and behave just like the original.
Symbolic links will point to another file by it's name. This allws symlinks to point to files located on other file systems even other network drives.