CentOS 7: Installing

Preface

A couple of words, why still CentOS, and not something else. General familiarity with Linux started in the year 2000 with some version of RedHat. Then there was the BlackCat Linux (because of its better support of the Russian language). Then came the Gentoo and I found it ideal for that due to the USE flags you only what you need. Oh and for the optimization of the more or less normal to watch movies on a computer with an AMD K6-2-300 can be only under Gentoo. After the Gentoo at work was Ubuntu, but it just didn’t go. Even after moving to any other Gentoo Linux is difficult. It’s like after OS X Windows back on land. In Gentoo and the boot process, and many other things are beautiful from the aesthetic point of view, in Ubuntu by default in a console only white on a black background.

Then there were courses on RHEL and certificate RHCSA. I find that stupid not to use knowledge – therefore decided to install CentOS onto a couple of servers to work under different services. In the process of so doing that even your own personal server is changed from Gentoo to CentOS. First there was the CentOS 5, then CentOS 6, and CentOS 7 is now.

Upgrade to CentOS has become much less time to leave on server maintenance time, as running the command:

runs faster than executing a command

Yes, and many surprises during the update, the system has become less. Although Gentoo, I am grateful for this experience.

 

Before installing CentOS 7 suggest to read this booklet RHEL 7: Installation Guide. Here you can download the whole or in the form of a .pdf file or as .epub file, who both will be comfortable. This is the official guide to install RHEL 7 (with Russian). And since RHEL is virtually the same as CentOS are all described in the brochure applicable to CentOS.

 

Download CentOS image

To install CentOS you must first download the installation CD image as an iso file. To do this, go to the Downloads section on the site of CentOS – http://www.centos.org/download/ and there we find the section «Minimal Install Images» and click on the link «Download the Minimal ISO» – http://isoredirect.centos.org/centos/7/isos/x86_64/. Then choose the nearest mirror and download the file CentOS-7.0-1406-x86_64-NetInstall.iso (in my case I connect to Yandex services via 100 MBit link so downloading with its mirrors).

 

Create installation media

To install CentOS virtual machine – simply specify the iso image as a virtual disk drive. If the installation will be done with the CD – burn the iso image to a CD any program available. You can burn the iso image to a USB drive and boot to it. To do this in Linux you can use the following command:

Instead of %filepath% need to specify the full path to the .ISO file and instead, %devname% must specify device name under which a Linux sees USB drive. Keep in mind that the USB drive at this point should not be mounted as well.
In Windows, to burn the iso image to a USB drive, you can use the Fedora live USB Creator program (https://fedorahosted.org/liveusb-creator/). You must download and install this program. Keep in mind, for her work to run with administrator privileges. After starting, click the iso image to write by clicking on the Browse button, then the Target Device, select the USB drive to record and click on the button «Create Live USB» button.

Fedora LiveUSB Creator

 

Prepare a virtual machine

In Parallels Desktop, click on the button «Create…» to create a new virtual machine, Parallels the wizard then select «Install Windows or another OS from the DVD or from the image» and click on the button «Continue». In the new wizard, Parallels, select «Image» and drag the iso image on the window of the wizard. The wizard will swear the message «Unable to determine the operating system», are not going to pay attention to it and click on the button «Continue». The wizard prompts you to select the operating system from the list, choose «CentOS Linux» in it under «Other versions of Linux» and click «OK». Select the name of the virtual machine, choose a location for the virtual machine, put a tick next to «Configure settings prior to the installation» and click on the button «Continue». Paint all the settings for the virtual machine, Parallels makes no sense, I note only that it is better to specify at least RAM 1GB, number of processors, can be increased to the maximum, and that’s hard disk can be cut back to 16GB (by default, Parallels makes 64GB). For a minimal installation and configuration of the basic network services 16GB it should suffice. Also pay attention to the network settings of the virtual machine to install we need to in a virtual machine is available Online (you can specify a network share instead of pavement, then the virtual machine in the local network). I’m back in the «Security» tab in the settings of the virtual machine, put a checkmark in the «Integration points: Isolate Linux from Mac» and «Time Machine: turn off» (because the virtual machine test). Now close the settings again, click on the button «Continue».

Parallels VM Status

 

Start CentOS installation

We start our computer (or virtual machine) from the media that we have prepared (or directly from the iso image). After the menu appears, which prompts you to start the installation process (click «Install CentOS 7» or run diagnostics and then start the Setup process (click «Test this media & Install CentOS 7»). Choose the second option and press «Enter».

CentOS Install: Grub Menu

After testing the media will be runs the CentOS 7 installer.
In the first window, select Installer Russian language and click on the button «Continue».

CentOS Install: Language Selection

Select your time zone and time setting the date as long as skip, is still up to the NTP client network settings will not be available.

CentOS Install: Main Menu

Let’s start with the keyboard settings, for this click on the button «Keyboard» and change the priority of the keyboard by moving the English layout upstairs. Just by clicking on the «Settings», you can change the key combination for switching keyboard layouts (for example Ctrl+Shift). Then click on the button «Finish».

CentOS Install: Keyboard Settings

For network settings click on the «Network name» and under «System Settings». By default, the network is disabled, to enable it, press the switch that is located in the upper right corner of the screen. All the network settings will be determined from DHCP server and determined from DNS host name. If this data is not automatically determined – you need to manually add them by clicking on the «Customize…».

CentOS Install: Network Settings

The «General» tab put a tick next to «Automatically connect to this network when it is available».

CentOS Install: Network Settings: Common

In the «IPv4 Settings» tab in the how to configure the or leave the selected «Automatically (DHCP)». If your network uses DHCP or change to «Manual» and fill all the remaining fields.

CentOS Install: Network Settings: IPv4

If we do not use IPv6 network, then the «IPv6 Settings» tab in the how to configure the select «Ignore».

CentOS Install: Network Settings: IPv6

After you save the network settings click on the «Finish» button in the upper left corner of the screen. Now you can go back to that step and configure the time zone and date. To do this, click on the «date and time» in the block of international. First choose a region and city, and then in the upper right corner click on switch «Network Time». After this time must be synchronized with the NTP server. You can click on the button «Finish» to return to the main menu of the installer.

CentOS Install: TimeZone Selection

Now let’s specify the repository from which you will install CentOS, for this now click on the button «Installation Source» in the block «Software». In the field, specify the path to the installation source, the primary repository of CentOS (in my case, I specify mirror.yandex.ru/centos/7/os/x86_64/). If you have access to the Internet is via proxy – the time that is specified by clicking on the button «Configure proxy…». Now click on the button «Finish».

CentOS Install: Repository

If the address of the repository is correct, now called «Installation Source» button will display the address of the repository, and button icons with orange triangle will hide. If this happens, click on the button «Select program» in the block «Software». During the initial installation, I set only the minimal set of programs and services that will run on the server, install and configure later. So leave the selected paragraph «minimum installation» and click on the button «Finish».

CentOS Install: Package Roles

Left adjust the location of the installation, and click the button «Place setting». Look what ticked is the desired hard disk, mark the item «I will configure the partitions» in the «Split» and click on the button «Finish».

CentOS Install: Storage Menu

We have partitioning Wizard opens. First, click on the button «Click here to automatically generate them».

CentOS Install: Storage Manual Formatting

Now a little touch up automatic breakdown.

CentOS Install: Storage Manual Formatting 2

To do this, first select the root partition «/» and change the size to 12GB. The type of device the LVM and xfs file system stay the same, but the name «Volume Group» let’s change the click on the button «Modify…». By default, the installer calls the LVM volume group as hostname_hostname, replace it to vg_hostname and click on the «Save» button (instead of the hostname with the name of your host). Now let’s change the name of the section to lv_root, instead of the root and press the button «Update settings».

CentOS Install: Storage Root Partition

For an even number will replace the /boot partition size is 500MB instead of 512MB point. Device type /boot partition leaving normal, file system, just leave the xfs, then click on «Update preferences» button.

CentOS Install: Storage Boot Partition

And finally change the settings section for the swap. The section name is interchangeable with swap on lv_swap, and increase the size to 4GB, and then push the button «Update settings». As the drive to install CentOS I only have 16GB, and we have already made partitions on a 16GB (12GB + 512MB + 4GB) – the installer automatically partition for the swap changed to 3,864GB limits.

CentOS Install: Storage Swap Partition

So as the root partition and swap partition we created as LVM volumes, then expand them in future not take much. Having completed the disk layout click on the button «Finish». We will show the markup sequence installer disk, we need to confirm by clicking on the «Apply changes».

CentOS Install: Storage Operations

Once everything has been prepared for installation of CentOS – click on the button «Start installation».

CentOS Install: Main Menu OK

The first thing the installer will mount the disk partitioning Setup, as we indicated earlier. Then partitions will be formatted and installation of packages. A minimal installation of these packages is 298. After you have installed the packages will be shipped to their initial setting.

CentOS Install: Processing

While packages are installed and configured, we set the password for the root user and create a user for everyday work (during the installation of the create user step is not mandatory, it can be at any time later).

CentOS Install: Root Password

The last step before reboot the installer configures the operating system boot loader. Then you will need to click on «Reload» in order to load freshly installed CentOS.

CentOS Install: Finish
Congratulations! CentOS installation is complete.

 

Before configuring a CentOS 7 read this here’s the brochure RHEL 7: System Administrators Guide. This is the official guide to configuring RHEL 7 (on Russian language this brochure not yet translated).

 

First run CentOS

After downloading the boot loader the boot selection menu appears, in which you can not press anything, by default, the first option will start a «CentOS Linux, with Linux 3.10.0-123.el7.x86_64».

CentOS: Grub Menu

The default booting enough silent, not showing absolutely nothing. But after booting we will see the standard prompt for a user name and password.

CentOS: Login

Continue to how convenient – you can either connect via ssh, or be using the console.

After login in CentOS first time – you need to perform some additional configuration. First, install the editor nano, and are doing so that all mail sent to the root user – will forwar to your email address.

In CentOS 6 then you must still restore the default SELinux context for .forward file with the command:

In CentOS 7 file is created with a correct context.

 

Set the locale and the Russian keyboard layout

Now after restarting the console we can switch keyboard layout by pressing Ctrl+Shift. Well, until the reboot will not manually load the desired layout is as follows:

 

Disable IPv6

There are two options for disabling IPv6 in CentOS 7, first edition hard:

It prohibits the kernel to load the modules associated with IPv6. This is bad because if SELinux is enabled (and why to CentOS and SELinux disabled?!), we will periodically receive swearing in the logs like:

So there is a more gentle option disable IPv6:

Similarly, after disabling IPv6 were not superfluous rantings from different services in the logs – you need to edit the configs postfix, time synchronization daemon chrony and sshd:

 

Setting up sshd daemon

On the new server, I immediately disable the authorization by password, leave only the authorization by key. And password authorization I authorize only certain IP addresses:

Note: use only if you know what you are doing!
 

Configure the package manager

Limit the number of installed package versions up to 3 (for example the number of versions of the installed kernel):

Turn on the check for new versions of packages (new versions will be coming in the mail, packages will not be automatically updated):

 

Updating the base system after installation

 

Installing the necessary tools and programs

Now connect the EPEL repository (Extra Packages for Enterprise Linux) and install packages, not in the basic installation:

There is also an interesting package atop in which you can see the statistics of the real-time server usage by processes and devices. But at the moment this package for CentOS 7 EPEL repository is in test, so is it with the following command:

Update: atop already placed into the main repository, so it can be installed simply by running:

But statistics looks like this:

 

Configuring the desktop environment

For convenient work in the console in the home directory, you must create files on the locale often used aliases and settings for various utilities:

After you create these files, it is best to log in order to apply all the changes.

Setup utility screen

I love working in the screen, first if, suddenly fall off the connection to the remote server, the session is complete, and will continue his run. This is especially true when remotely started a long process that should not be interrupted.
Plus, I adjusted the screen in such a way that it starts as soon as we have created 10 consoles, and switch between them as easily as if you were sitting for the protection of Linux console Alt+F1, Alt+F2, etc to Alt+F10. You can also press Ctrl+Alt+Left/Right arrow to switch between consoles left-to-right.

Note: If you run Midnight Commander in screen, that he had not worked for the subshell (not worked for shell in mc). To fix, add this line to your file .screenrc line “shell -$SHELL“.

 

Customizing the editor nano

Nano is a great little Editor. But a lot of it is undeservedly not love. This is for good reason. With small tuning nano can even syntax highlighting. Not as cool as the same vim, but in general it is better than black and white.

 

Finish

And, finally, reboot our server:

 

Update: features of temporary work with qwertz

If, all of a sudden, you will install CentOS on some German qwertz layout, hosting without the ability to change it for the qwerty, it is necessary to remember the following:

Just don’t forget the password that you enter with the keyboard qwertz then not suitable when accessed via ssh, so that at the time of installation, put a simple password, then when you first login via ssh, already change it to normal.
 

Configure various services

Also, you can read the following notes on setting up various services in CentOS/RHEL:


Leave a Reply