[go: up one dir, main page]

0% found this document useful (0 votes)
10 views20 pages

Initial Server Setup and Configurations On CentOS 7

This document provides a comprehensive guide for the initial server setup and configuration on CentOS 7, including steps for updating the system, installing essential utilities, configuring networking, managing services, enabling the firewall, and setting up SSH key authentication. It emphasizes the importance of securing the server by disabling unnecessary services and ensuring proper user permissions. The tutorial is aimed at beginners and includes commands and utilities necessary for effective system administration.

Uploaded by

n0madd3v0ps
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views20 pages

Initial Server Setup and Configurations On CentOS 7

This document provides a comprehensive guide for the initial server setup and configuration on CentOS 7, including steps for updating the system, installing essential utilities, configuring networking, managing services, enabling the firewall, and setting up SSH key authentication. It emphasizes the importance of securing the server by disabling unnecessary services and ensuring proper user permissions. The tutorial is aimed at beginners and includes commands and utilities necessary for effective system administration.

Uploaded by

n0madd3v0ps
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

5/7/2020 Initial Server Setup and Configurations on CentOS 7

RedHat RHCSA and RHCE Certi cation eBook Based on RHEL 8 Get This Book

CENTOS 5 I TecMint :

BEGINNER'S GUIDE FOR LINUX


Initial Server Setup Start learning Linux in minutes

and Configurations
on CentOS 7
by Matei Cezar | Published: October 9, 2017 |
Last Updated: October 25, 2017

https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 1/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

Linux Certi
RedHat RHCSAcations
and- RHCSA
RHCE/ RHCE
Certi cation eBook Based on RHEL 8 Get This Book
Certi cation | Ansible Automation
Certi cation | LFCS / LFCE Certi cation

This tutorial will explain the rst basic


steps you need to go through after
installing a minimal CentOS 7 system
with no graphical environment in order
to obtain information about the installed
system, the hardware on top of which
runs the system and con gure other
speci c system tasks, such as Vi/Vim Editor BEGINNER'S GUIDE
networking, root privileges, software, Learn vi/vim as a Full Text Editor
services and others.

Requirements
CentOS 7 Minimal Installation

Important: RHEL 7 users, can follow this


article to do a Initial Server Setup on
RHEL 7.

Update CentOS 7
System
Linux Foundation Certi cation
The rst step you need to perform on a Exam Study Guide to LFCS and LFCE
fresh installed CentOS system is to
make sure the system is up-to-date with
the latest kernel and system security
patches, software repositories and How to Add Linux Host to Nagios Monitoring
packages. Server Using NRPE Plugin

To fully update a CentOS 7 system, How to Install Nagios 4.4.5 on RHEL/CentOS 8/7
and Fedora 30
issue the following commands with root
privileges. Install Cacti (Network Monitoring) on
RHEL/CentOS 8/7 and Fedora 30

How to Install Google Chrome 75 On RHEL/CentOS


7 and Fedora 30
https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 2/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

RedHat RHCSA
# yum and RHCE Certi cation eBook Based on RHEL 8
check-update Get This Book
How to Install Ubuntu Alongside With Windows 10
# yum upgrade or 8 in Dual-Boot

After the upgrade process completes, in


order to release disk space you can
remove all downloaded packages that
where used in the process of upgrading
alongside with all cached repositories
information by executing the following
command.

# yum clean all

Yum Clean All on CentOS 7


Linux System Administrator Bundle
with 7-Courses (96% off)
Install System Utilities
on CentOS 7 Add to Cart - $69
Ending In: 3 days
The following utilities packages can
prove to be useful for day-by-day Computer Hacker Professional
system administration: nano (text editor Certi cation Course (96% Off)
to replace vi editor), wget, curl (utilities
used for downloading packages over Add to Cart - $59
network mostly) net-tools, lsof (utilities
Ending In: 4 days
for managing local networking) and
bash-completion (command line
autocomplete). LINUX EBOOKS

Introducing Learn Linux In One Week and Go


Install them all in one-shot by executing
from Zero to Hero
the below command.
RedHat RHCE/RHCSA Certi cation Preparation
Guide
https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 3/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

Linux Foundations LFCS/LFCE Certi cation


RedHat RHCSA
# yum and RHCE
install Certi wget
nano cation eBook Based on RHEL 8 Get This Book
Guide
Post x Mail Server Setup Guide for Linux
Ansible Setup Guide for Linux
Django Setup Guide for Linux
Awk Getting Started Guide for Beginners
Citrix XenServer Setup Guide for Linux

Never Miss Any Linux Tutorials,


Install System Utilities Guides, Tips and Free eBooks
Join Our Community Of 150,000+ Linux Lovers
Setup Networking in and get a weekly newsletter in your inbox

CentOS 7 YES! SIGN ME UP

CentOS 7 has a wide range of tools that


can be used to con gure and manage
networking, from manually editing the
network con guration le to using
commands such as ip, ifcon g, nmtui,
nmcli or route.

The easiest utility a beginner can use to


manage and change network
con gurations is nmtui graphical
command line.

In order to change the system


hostname via nmtui utility, execute
nmtui-hostname command, set your
machine hostname and press OK to
nish, as illustrated in the below
screenshot.

# nmtui-hostname

https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 4/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

RedHat RHCSA and RHCE Certi cation eBook Based on RHEL 8 Get This Book

Set Hostname in CentOS 7

To manipulate a network interface,


execute nmtui-edit command, choose
the interface you want to edit and select
edit from the right menu, as shown in
the below screenshot.

# nmtui-edit

Con gure Network in CentOS 7

Once you’re in the graphical interface


provided by nmtui utility you can setup
the network interface IP settings as
illustrated in the below screenshot.
When you nish, navigate to OK using
[tab] key to save the con guration and
quit.

Setup Network IP Address


https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 5/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

RedHat RHCSA and RHCE Certi cation eBook Based on RHEL 8 Get This Book
In order to apply the network interface
new con guration, execute nmtui-
connect command, select the interface
you want to manage and hit on
Deactivate/Activate option to
decommission and rise-up the interface
with the IP settings, as presented in the
below screenshots.

# nmtui-connect

Active Network Interface

In order to view the network interface


settings, you can inspect the content of
the interface le or you can issue the
below commands.

# ifconfig enp0s3
# ip a
# ping -c2 google.com

Verify Network Con guration

https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 6/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

Other useful
RedHat RHCSA utilities that can
and RHCE be used
Certi toeBook Based on RHEL 8
cation Get This Book
manage speed, link state or obtain
information about machine network
interfaces are ethtool and mii-tool.

# ethtool enp0s3
# mii-tool enp0s3

Check Network Connection

An important aspect of your machine


networking is to list all open network
sockets in order to see what programs
are listening on what ports and what’s
the state of the established network
connections.

To list all servers that have opened TCP


or UDP sockets in listening state issue
the following commands. However, UDP
server won’t list any socket state due to
the fact that UDP is a connectionless
protocol which only sends packets over
network and doesn’t establish
connections.

# netstat -tulpn
# ss -tulpn
https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 7/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

# lsof
RedHat -i4
RHCSA -6 Certi cation eBook Based on RHEL 8
and RHCE Get This Book

Manage Services in
CentOS 7
CentOS 7 manages daemons or service
via systemctl utility. In order to list all
services state, issue the following
command.

# systemctl list-units

List All Services State

To check if a daemon or service is


enabled to automatically start when the
system starts, issue the following
command.

# systemctl list-unit-fi

https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 8/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

List Enabled Services


RedHat RHCSA and RHCE Certi cation eBook Based on RHEL 8 Get This Book

To list the old SysV services present in


your system and disable them issue the
following chkcon g commands.

# chkconfig --list
# chkconfig service_name

5. Disable Unwanted
Services in CentOS 7
It’s recommended after installing
CentOS 7, to list what services are
running in the system by running the
above commands and disable and
remove them in order to reduce the
attacks vectors against your system.

For instance, Post x daemon is


installed and enabled by default in
CentOS 7. If your system don’t require
running a mail server, it’s best to stop,
disable and remove the post x service
by issuing the below commands.

# systemctl stop postfix


# systemctl disable post
# yum remove postfix

In addition to netstat, ss, lsof or


systemctl commands, you can also run
ps, top or pstree commands in order to
discover and identify what unwanted

https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 9/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

servicesRHCSA
RedHat are running in yourCerti
and RHCE system and eBook Based on RHEL 8
cation Get This Book
disable or remove them.

By default, pstree utility is not installed


in CentOS 7. To install it execute the
following command.

# yum install psmisc


# pstree -p

List Linux Processes in Tree Format

Enable Firewall in
CentOs 7
Firewalld is the main rewall utility that
uses interacts with in order to manage
iptables rules.
To enable and start and verify the
rewall in CentOS 7, execute the
following commands.

# systemctl enable firew


# systemctl start firewa
# systemctl status firew

In order to open a speci c service to


incoming connections, rst verify if the
application is already present in
https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 10/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

rewalldRHCSA
RedHat rules and,
andthen,
RHCEadd the cation
Certi rule eBook Based on RHEL 8 Get This Book
for the service, as shown in the below
example which allows SSH incoming
connections. Use --permanent switch
to add the rule permanently.

# firewall-cmd --add-ser
# firewall-cmd --add-ser
# firewall-cmd --add-ser

Open Service in Firewalld

In case the service is now already


de ned in rewalld rules, you can
manually add the service port, as shown
in the below example.

# firewall-cmd --add-por
# firewall-cmd --reload

Enable Sudo
Permissions on User
Accounts
https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 11/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

In orderRHCSA
RedHat to grantand
rootRHCE
permissions for a eBook Based on RHEL 8
Certi cation Get This Book
normal user, rst create the user by
issuing adduser command, set the
password for the user and grant root
permissions to the user by executing
the below command which adds the
new user to the administrative wheel
group.

# adduser tecmint
# passwd tecmint
# usermod -aG wheel tecm

To test if the new user has root


privileges, login to the system with
user’s credentials and run yum
command with sudo permissions, as
shown in the below excerpt.

# su - tecmint
# sudo yum update

Verify Sudo User Permissions

https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 12/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

Configure SSH Public


RedHat RHCSA and RHCE Certi cation eBook Based on RHEL 8 Get This Book

Key Authentication on
CentOS 7
In order to secure SSH your server and
set up public key authentication to
increase the security of your server with
a private SSH key to log in, rst
generate a SSH Key Pair with a
following command.

Don’t not enter a passphrase in case


you want to automate server
management via SSH.

# ssh-keygen -t RSA

After the SSH key pairs had been


generated, copy the key to the server
you want to connect to by issuing the
below command. Initially, enter you
remote SSH user password in order to
copy the public key.

# ssh-copy-id remote_use

After the SSH public key has been


copied to the remote server, login to the
remote SSH server with the following
command.

# ssh remote_user@SSH_SE

https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 13/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

Finally, in
RedHat order to
RHCSA andsecure
RHCEthe SSHcation eBook Based on RHEL 8
Certi Get This Book
server, make sure you disallow remote
SSH access to the root account by
opening the con guration SSH le
/etc/ssh/sshd_con g with your text
editor as root and change it from Yes
to No .

PermitRootLogin no

To apply the setting you need to restart


the SSH service so that it will use the
new con guration.

# systemctl restart sshd

That’s all! These are just a few basic


settings and commands every system
administrator needs to know and apply
on a fresh installed CentOS system or in
order to perform day to day tasks on the
system.

To secure and harden CentOS 7 server,


check out these following articles.

The Mega Guide To Harden and


Secure CentOS 7 – Part 1
The Mega Guide To Harden and
Secure CentOS 7 – Part 2

If you’re planning to deploy websites on


this CentOS 7 system, learn how to
setup and con gure LAMP stack or
LEMP stack.

https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 14/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

SharingRHCSA
RedHat is Caring...
and RHCE Certi cation eBook Based on RHEL 8 Get This Book

Share on Facebook Share on Twitter

Share on Linkedin Share on Reddit

If You Appreciate
What We Do Here On
TecMint, You Should
Consider:

TecMint is the fastest


growing and most trusted
community site for any kind
of Linux Articles, Guides
and Books on the web.
Millions of people visit
TecMint! to search or
browse the thousands of
published articles available
FREELY to all.

If you like what you are


reading, please consider
buying us a coffee ( or 2 )
as a token of appreciation.

We are thankful for your


never ending support.

https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 15/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

RedHat RHCSA and RHCE Certi cation eBook Based on RHEL 8 Get This Book
Tags: CentOS 7 Initial Con gurations

Initial Linux Server Setup

Matei View all Posts


Cezar
I'am a computer addicted
guy, a fan of open source
and linux based system
software, have about 4
years experience with Linux
distributions desktop,
servers and bash scripting.

Your name can also


be listed here. Got a
tip? Submit it here to
become an TecMint
author.

PREVIOUS NEXT STORY


STORY How to
TMOUT – Disconnect
Auto Logout Inactive or
Linux Shell Idle SSH
When There Connections
Isn’t Any in Linux
Activity

YOU MAY ALSO LIKE...


https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 16/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

RedHat RHCSA
17 and RHCE
40 Certi cation
7 eBook Based on RHEL 8 Get This Book

Disable
Certain
How to 13 Basic Package
Con gure Cat Updates
LDAP Command using YUM
Client to Examples in RHEL /
Connect in Linux CentOS /
External Fedora
25 AUG,
Authentica 2012 28 SEP, 2012
tion
13 DEC,
2018

5 RESPONSES

Comments 5 Pingbacks 0

Lester October 28, 2019 at 7:13 am


Hi,
Please help how to install and setup
the con guration of Zimbra in
CentOS. Thanks!
Reply

Ravi Saive
October 30, 2019 at 11:45 am
@Lester,
Follow this article to setup
Zimbra on CentOS.
Reply

Narendra
December 13, 2018 at 1:09 am
Hi, This is Narendra,
I Want to install the CentOS on my
windows10 operating system as you
know Windows recently added an
option for developer.
Through that how can i know install
the CentOs.
https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 17/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7
Reply
RedHat RHCSA and RHCE Certi cation eBook Based on RHEL 8 Get This Book
Ravi Saive
December 13, 2018 at 11:21
am
@Narendar,
You mean CentOS Dual Boot
with Windows? if yes, you
should read this article –
https://www.tecmint.com/ins
fedora-27-with-windows-10-
or-8-in-dual-boot/
Reply

Evas September 15, 2018 at 5:25 pm


Server (desktop pc) which is
minimall centos 7, encrypted
partitions, how to make it accessible
after a power failure recovery. As the
system stops at the screen for
asking of the passphrase to boot.
Is it possible to make it booted and
accessed remotely and at the same
time in front of physical (Desktop pc)
monitor stay not logged in?
Reply

GOT SOMETHING TO SAY? JOIN THE


DISCUSSION.

Comment

Name * Email *

Website

Save my name, email, and website in this


browser for the next time I comment.

https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 18/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

Notify meand
RedHat RHCSA of followup
RHCE comments
Certi cation eBook Based on RHEL 8 Get This Book
via e-mail. You can also subscribe without
commenting.

Post Comment

This site uses Akismet to reduce spam.


Learn how your comment data is processed.

LINUX MONITORING TOOLS LINUX INTERVIEW OPEN SOURCE TOOLS

QUESTIONS
How to Install Zabbix Agent 6 Best CCleaner
and Add Windows Host to Alternatives for Ubuntu
Zabbix Monitoring – Part 4 10 Core Linux Interview
Questions and Answers 16 Best Open Source Video
How to Install Zabbix on Players For Linux in 2020
RHEL 8 Shilpa Nair Shares Her
Interview Experience on 10 Best Clipboard
3 Ways to Check Apache RedHat Linux Package Managers for Linux
Server Status and Uptime Management
in Linux 10 Top Open Source
10 Useful Interview Caching Tools for Linux in
Install Glances, In uxDB Questions on Linux 2020
and Grafana to Monitor Services and Daemons
CentOS 7 6 Best PDF Page Cropping
11 Basic Linux Interview Tools For Linux
How to Install Nagios Questions and Answers
Monitoring Tool on RHEL 8
10 Interview Questions and
Answers on Various
Commands in Linux

https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 19/20
5/7/2020 Initial Server Setup and Configurations on CentOS 7

RedHat RHCSA and RHCE Certi cation eBook Based on RHEL 8 Get This Book

Tecmint: Linux Howtos, Tutorials & Guides ©


2020. All Rights Reserved.
The material in this site cannot be republished
either online or o ine, without our permission.
Hosting Sponsored by : Linode Cloud Hosting

https://www.tecmint.com/centos-7-initial-server-setup-and-configuration/ 20/20

You might also like