Getting Started with CentOS 7
CentOS 7 is the latest release of the community supported RHEL-based Linux distribution. CentOS 7 strives to be as stable, predictable, and secure as the upstream RHEL release. It also strives to be as compatible as possible with the upstream RHEL release. If you are looking for a stable and reliable Linux platform for your projects, CentOS 7 is a good choice.
After you've created your first Codero Cloud Server CentOS 7 VM, you should create a non-root user for logging into and managing your CentOS 7 system. First, log in to your system as root using the password provided by the Codero Cloud Server Portal:
is the IP address given on your Codero Cloud Server Portal for this VM.
Next, create the new user:
should be the username you want for your new user.
Next, give the
You will be prompted to enter a password and to verify the password. Choose a password that is easy to remember but difficult to guess.
Finally, add the
wheel group so the
usermod -G wheel
It's very important that the last command succeeded, so let's verify that everything went well.
You should see output like this:
If so, you're ready to log out as root and log in as your new user. After doing so, make sure your
sudo yum check-update
You will be prompted for your
wheel group as shown above. If the command succeeded, you can proceed to the next section.
Disable root SSH logins
Now that we have a user that can assume superuser privileges, let's disable root SSH logins. Edit the
/etc/ssh/sshd_config file using whichever editor you're comfortable with (I'll use
sudo vim /etc/ssh/sshd_config
Find the line containing
#PermitRootLogin yes and change it to
PermitRootLogin no. Save the file. Then restart the SSH service:
sudo systemctl restart sshd
Optional: Lock the root user
You can totally lock the root user account so that it cannot be directly accessed. However, if you do so, Codero Support will be unable to log into your Cloud Server VM instance for troubleshooting purposes. Only do this if you are certain you will not need Codero Support to help you troubleshoot configuration errors you might make on your Cloud Server VM instance. You have been warned.
sudo passwd -l root
To undo this:
sudo passwd -u root
Update your installation
Now we'll update our CentOS 7 installation. First, install the
sudo yum install deltarpm
DeltaRPMs are files that contain only the changes between the software already installed on your system and the new version to be upgraded. This saves a little network usage at the expense of a little CPU time.
Next, let's check for updates:
sudo yum check-update
You'll see the list of packages to be installed. Now, let's do the upgrade:
sudo yum upgrade
This will take several minutes. You will be prompted to approve the upgrade. You may also be prompted to approve the GPG keys of the CentOS yum repo. This is normal and you should say yes. After the updates complete, you should reboot your Cloud Server VM:
sudo shutdown -r now
EPEL is a community-contributed set of packages for RHEL and CentOS that aren't included in the default repositories. EPEL provides many packages that you may want to install to make your CentOS environment more efficient or to support applications you may want to run on your Codero Cloud Server VM. To install EPEL:
sudo rpm -ivh http://fedora.mirrors.pair.com/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
The URL for the EPEL package is correct at the time this document was written. You should check here for the most up-to-date version of the EPEL package. Next, let's update the RPM database again to add the packages from EPEL:
sudo yum check-update
Now, let's install an incredibly useful package from EPEL,
sudo yum install bash-completion
You will be prompted to approve the install. After the install completes, log out and log back into your Cloud Server VM. You should now be able to enjoy bash tab completion. For example:
means press the Tab key twice.
You should see output similar to the following:
check distro-sync history load-transaction remove update check-update downgrade info makecache repolist upgrade clean groups install provides search version deplist help list reinstall shell
Make your hostname permanent
CentOS 7 uses the
hostnamectl command to manage hostnames. To make your hostname permanent:
sudo hostname set-hostname
should be the hostname you want. It probably should match the hostname you set when you created the Cloud Server VM, but this is not a requirement.
To verify your change was applied, run
hostnamectl with no options:
You should see the
Static hostname: line.
Contgratulations! You now have a CentOS 7 Cloud Server VM instance with a non-root user, root SSH logins disabled, the EPEL repository installed and enabled, and a permanent hostname. You can install and run a wide range of platforms and frameworks for networking applications and web development. Look for future articles to learn more about CentOS 7 and how it differs from previous releases of CentOS.ÂPosted in