Getting started with centos
CentOS versions download: here
"The CentOS Linux distribution is a stable, predictable, manageable and reproducible platform derived from the sources of Red Hat Enterprise Linux (RHEL). Since March 2004, CentOS Linux has been a community-supported distribution derived from sources freely provided to the public by Red Hat. As such, CentOS Linux aims to be functionally compatible with RHEL.
The CentOS Project is a community-driven free software effort focused around the goal of providing a rich base platform for open source communities to build upon. We will provide a development framework for cloud providers, the hosting community, and scientific data processing, as a few examples. We work with several ‘upstream’ communities to help them layer and distribute their software more effectively on a platform they can rely on.
The CentOS Project is modelled on the structure of the Apache Foundation, with a governing board that oversees various semi-autonomous Special Interest Groups or ‘SIGs’. These groups are focused on providing various enhancements, addons, or replacements for core CentOS Linux functionality. A few notable examples of SIGs are:
Core - Building and releasing the core CentOS Linux platform. Xen4CentOS - Providing Xen4 support for CentOS 6 CentOS Design - Improving the user experience with high quality artwork."*
*find more here: https://www.centos.org/about/
|CentOS Version||Release Date|
Documentation How To guide for CentOS
CentOS 7 is fully based on RedHat the detail documentation, examples and system administration guides are located here:CentOS 7 full documention
Installation or Setup
Detailed instructions on getting CentOS 7 installation and basic set up for starting on.
- Download latest CentOS .ISO - https://www.centos.org/download/
- After downloading the last version of CentOS using above links or using official CentOS download page. Burn it to a DVD or create a bootable USB stick using LiveUSB Creator called Unetbootin.
- After you have created the installer bootable media, place your DVD/USB into your system appropriate drive, start the computer, select your bootable unit and the first CentOS 7 prompt should appear. At the prompt choose Install CentOS 7 and press [Enter] key.
- The system will start loading media installer and a Welcome screen should appear. Select your Installation Process Language, that will assist you through the entire installation procedure and click on Continue.
- The next step, present screen prompt is Installation Summary. It contains a lot of options to fully customize your system. First thing you may want to setup is your time settings. Click on Date & Time and select your server physical location from the provided map and hit on upper Done button to apply configuration.
- The next step is to choose your Language Support and Keyboard settings. Choose your main and extra language for your system and when you’re finished hit on Done button.
- The same way choose your Keyboard Layout by hitting the plus button and test your keyboard configuration using the right input filed. After you finish setting up your keyboard, you can use any key combination for switching between keyboards, in my case I am using Alt+Ctrl. After selection of your desired key combination, press Done again to apply changes and go back to main screen on Installation Summary.
- Now we can add LANGUAGE SUPPORT if you don't want to use English. Click on "LANGUAGE SUPPORT" to open the dialog.
- By default, CentOS comes with English language preinstalled, but we can add more languages easily. In my case, I am adding Deutsch German with Deutsch (Deutschland) as the additional language. Press Done after selection.
- On the next step you can customize your installation by using other Installation Sources than your local DVD/USB media, such as a network locations using HTTP, HTTPS, FTP or NFS protocols and even add some additional repositories, but use this methods only if you know what you’re doing. So leave the default Auto-detected installation media and hit on Done to continue.
On the next step you can choose your system installation software. On this step CentOS offers a lot of Server and Desktop platform environments that you choose from, but, if you want a high degree of customization, especially if you are going to use CentOS 7 to run as a server platform, then I suggest you select Minimal Install with Compatibility Libraries as Add-ons, which will install a minimal basic system software and later you can add other packages as your needs require using:
- Now it’s time to partition your hard-drive. Click on Installation Destination menu, select your disk and choose I will configure partitioning. Read more about what partition to choose here: https://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-diskpartitioning-x86.html
- On the next screen, choose LVM (Logical Volume Manager) as partition layout and, then, click on Click here to create them automatically, option which will create three system partition using XFS filesystem, automatically redistributing your hard-disk space and gathering all LVS into one big Volume Group named “centos”.
- /boot – Non LVM
- /(root) – LVM
- Swap – LVM
- If you are not pleased with the default partition layout done automatically by the installer you can completely add, modify or resize your partition scheme and when you finish hit on Done button and Accept Changes on the Summary of Changes prompt.
NOTE: For those users, who have hard-disks more than 2TB in size, the installer automatically will convert partition table to GPT, but if you wish to use GPT table on smaller disks than 2TB, then you should use the argument inst.gpt to the installer boot command line in order to change the default behavior.
- The next step is to set your system hostname and enable networking. Click on Network & Hostname label and type your system FQDN (Fully Qualified Domain Name) on Hostname filed, then enable your Network interface, switching the top Ethernet button to ON. If you have a functional DHCP server on you network then it will automatically configure all your network setting for enabled NIC, which should appear under your active interface.
- If your system will be destined as a server it’s better to set static network configuration on Ethernet NIC by clicking on Configure button and add all your static interface settings like in the screenshot below, and when you’re finished hit on Save button, disable and enable Ethernet card by switching the button to OFF and ON, and, then hit on Done to apply setting and go back to main menu.
- Add the entries for Address, Netmask and Gateway as per your static IP environment. In my case I am using Address as 192.168.1.100, Netmask 255.255.255.0, Gateway as 192.168.1.1 and DNS servers as 188.8.131.52 184.108.40.206 These values may vary according to your network environment. After that press Save.
IMPORTANT: If you do not have an IPv6 internet connection, then set IPv6 from auto to ignore on the IPv6 tab, otherwise you won't be able to reach the internet from this server on IPv4 as CentOS seems to ignore the correct IPv4 setup then and uses IPv6 instead which fails.
- Next, we have to turn the connection ON as shown in the screenshot below. Further press Done.
- Now it’s time to start installation process by pressing on Begin Installation button and set up a strong password for root account.
- The installation process will start now and you get a small blue progress bar in the next windows. Now we have to set the ROOT PASSWORD and add a new non-root user in the USER CREATION option. I will first go for root password.
- Enter a secure password of your choice and press Done
- Next we will go for USER CREATION.
- Next I will create user, as in my case I used the Full name "Administrator" and Username "administrator", check the option Require the password to use this account and then press Done. Off-course you can use any value as per your choice.
- Press Finish.Have patience and wait for the completion of the setup.
- After completion of the installation, it will ask to reboot the server, just press Finish configuration.
- The server reboots and will request your username and password afterwards.
Congratulation! You have now installed last version of CentOS on your bare new machine. Remove any installation media and reboot your computer so you can login to your new minimal CentOS 7 environment and perform other system tasks, such as update you system and install other useful software needed to run day to day tasks.
- Now we are ready to do login with the user that we just created above or we can use the root credentials.
First Login on CentOS
Login as root user to the server so we can do some final installation steps.
The first one is to install all available updates with yum.
confirm with "y" to proceed with the installation of the updates.
I will install two command line editors to be able to edit configuration files on the shell:
CentOS 7.2 minimal don't come pre-installed with the ifconfig command we will install it as follows:
If you want to change or see the network configuration file, just edit the file
It will be like this when you configured a static IP address:
Change the values if required.
Note: The above DEVICE name may vary so please check the equivalent file in the directory /etc/sysconfig/network-scripts.
Adjust the file /etc/hosts as follows:
Make the values like this:
Congratulations! Now we have basic minimal CentOS 7 server setup
Now you may prefer to use GUI instead, here is a variety of flavor you could choose from:
Install GNOME Desktop Environment by entering.
To start the GUI enter after finishing installation:
How to use GNOME Shell?
The default GNOME Desktop of CentOS 7 starts with classic mode but if you'd like to use GNOME Shell, set like follows:
Option A: If you start GNOME with startx, set like follows.
Option B: set the system graphical login systemctl set-default graphical.target and reboot the system. After system starts
- Click the button which is located next to the "Sign In" button.
- Select "GNOME" on the list. (The default is GNOME Classic)
- Click "Sign In" and log in with GNOME Shell.
GNOME shell starts like follows:
Install KDE Desktop Environment by entering
Input a command like below after finishing installation:
KDE Desktop Environment starts like follows:
Installing MATE Desktop Environment:
Install MATE Desktop Environment by entering.
Input a command like below after finishing installation:
MATE Desktop Environment starts.
Installing Xfce Desktop Environment:
Install Xfce Desktop Environment by entering.
Input a command like below after finishing installation:
Xfce Desktop Environment starts.
OTHER WAY TO DO IT:
Rather than make use of the hacking of a startx command into a .xinitrc file, it's probably better to tell Systemd that you want to boot into a graphical GUI vs. the terminal.
To accomplish this simply do the following:
Then simply reboot.
The last bit will associate the runlevel 5 target as your default with respect to Systemd.
Doing it with Systemd
You can also use Systemd to accomplish this. This is arguably the better method since you're managing the state of the system directly through Systemd and its CLIs.
You can see what your current default target is:
And then change it to graphical:
In Systemd the targets runlevel5.target and graphical.target are identical. So too are runlevel2.target and multi-user.target.
RHEL / CentOS Linux Install Core Development Tools Automake, Gcc (C/C++), Perl, Python & Debuggers
Q. How do I install all developer tools such as GNU GCC C/C++ compilers, make and others, after installing CentOS or RHEL or Fedora Linux from a shell prompt?
You need to install ‘Development Tools’ group on RHEL/CentOS/Fedora/Scientific/Red Hat Enterprise Linux. These tools include core development tools such as automake, gcc, perl, python, and debuggers which is required to compile software and build new rpms:
- gcc c/c++ compiler
- gcc-c++ compiler
- binutils and all dependencies.
Open the terminal or login over ssh session and type the following command as root user:
Sample outputs that follows:
Now you can compile and use any application on your system.
To display Gnu gcc/c/c++ compiler version type:
How do I list all currently running services in Fedora / RHEL / CentOS Linux server?
There are various ways and tools to find and list all running services under Fedora / RHEL / CentOS Linux systems.
The syntax is as follows for CentOS/RHEL 6.x and older (pre systemd):
Print the status of any service. To print the status of apache (httpd) service:
List all known services (configured via SysV)
List service and their open ports
Turn on / off service
ntsysv is a simple interface for configuring runlevel services which are also configurable through chkconfig. By default, it configures the current runlevel. Just type ntsysv and select service you want to run.
A note about RHEL/CentOS 7.x with systemd
If you are using systemd based distro such as Fedora Linux v22/23/24 or RHEL/CentOS Linux 7.x+. Try the following command to list running services using the systemctl command. It control the systemd system and service manager.
To list systemd services on CentOS/RHEL 7.x+ use
The syntax is:
To list all services:
above image shows List all units installed on the CentOS /RHEL 7 systemd based system, along with their current states
To view processes associated with a particular service (cgroup), you can use the systemd-cgtop command. Like the top command, systemd-cgtop lists running processes based on their service:
To list SysV services only on CentOS/RHEL 7.x+ use (does not include native systemd services)
FIREWALL HOW TO:
- Install Gnome GUI on CentOS 7 / RHEL 7
- 8.3. WORKING WITH SYSTEMD TARGETS