Menu

Linux

Linux Notes

 

 

 


Accessing your Virtual Machine Apache Web Server from your local Web Browser

Steps to create a Web Server on VBOX made accessbile to web client on Host OS
1. Install VirtualBox (From Oracle)
2. Install CentOS7 or higher CentOS version on VirtualBox
3. Go to Network configuration on your CentOS7 machine (Default is “NAT”)
4. Got to “advanced”
5. Click “port forwarding”
6. Configure your host OS localhost with port 80 or a high port number (Ex: 9090), and then your guest OS to port 80
In your virtual machine
Enable port 80 on firewalld (CentOS7)
1. firewall-cmd –permanent –add-port=80/tcp
2. firewall-cmd –reload


 


Standard run levels for Red Hat based distributions (DEPRECATED)
Run Level Mode Action
0 Halt Shuts down system
1 Single-User Mode Does not configure network interfaces, start daemons, or allow non-root logins
2 Multi-User Mode Does not configure network interfaces or start daemons.
3 Multi-User Mode with Networking Starts the system normally.
4 Undefined Not used/User-definable
5 X11 As runlevel 3 + display manager(X)
6 Reboot Reboots the system


 


Linux is a true multitasking and multiuser operating system.


 


When using a login shell, the bash shell program searches for configuration files in the following order:
1. ~/.bash_profile
2. ~/.bash_login
3. ~/.profile
It uses the first file it finds and ignores all of the rest
Remember, .bashrc is not read by bash when loading a login shell


 


Shell/Environment variables are variables in Linux which contain a value
Shell variable names cannot contain spaces
Shell variable values can contain spaces. If you want your shell value to include spaces you have to enclose
your shell varaible name with double quotes. Ex): “Hello there”


 


The “exec” command is used to execute commands on a completely new shell. When the program which was runned
by the “exec” command is terminated, the shell that was created by using the “exec” command is also
terminated (Not actually correct. When you use the “exec” command, whatever program/process is runned
is actually replaced by a new process apart from the current shell (The shell process))


 


A daemon is just a term for a process that runs continuously and usually is not attached to a terminal.


 


Page memeory refers to virtual system memory. Page memory is saved in an architecture called a “Page Table”. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory.

To see what swap space you have, use the command swapon -s
Linux has two forms of swap space: the swap partition and the swap file. The swap partition is an independent section of the hard disk used solely for swapping; no other files can reside there. The swap file is a special file in the filesystem that resides amongst your system and data files.


 


LOCALSTORAGE FILE
Persistent files on a users machine, created by an application, used by the application to save the state of an application/application-feature.


 


PROPERLY SHUTDOWN LINUX MACHINE:
poweroff


 


To find out what the name of a package that includes a certain command/utility is:
yum whatprovides name_of_command


 


To update locate command/program database
Login as root user then use: updatedb


 


To list Network Details

“ip a” & “ifconfig” show same results


 


Displays first 10 lines by default

UNIX head command: You can specify line with “-n” option


 


SSH: Secure Socket Shell


 


Check if a program is installed in Unix and show where program files appear:

which <Program Name>


 


To list all programs installed in CentOS/RHEL:

rpm -qa
yum list installed <package_name> (You must use exact package name)


 


To display info about a “yum” package:

yum info <package-name>


 


lsof -i TCP:22lsof -i TCP:22


 


iptables -L


 


In centOS “ip addr” is equal to “ifconfig”

“ifconfig” is obsolete


 


To renew a DHCP IP address if your node is a DHCP client:

sudo dhclient


 


Restart service of anything after a change to the configuration/configuration file(s) of that service have been changed in any way


 


a


 


a


 


a


 


a


 


a


 


a


 


a


 


a


 


a


 


a


 


a