CentOS: Updating System and Application software using SSH

Managing software

From inside the terminal application, you have the ability to manage your CentOS server by using the yum command. The yum command allows you to modify the following aspects of your server:

  • install new software from package repositories
  • update existing software on your system
  • remove unwanted software from your system

Searching and installing new software with yum

Linux distributes server applications in packages and using yum you have the ability to search for a necessary package by using its specific name. To search for a specific package by name in yum you will use the list function. To use the list function in yum you will use the following command:

yum list CHANGETHIS

If you are  looking for the nginx web server, you will use the following command:

yum list nginx

yum_list_nginx.png

Often, you may not know the exact name of the application you are searching for on your server. If you do not know the exact name of the application, you can use the search option in yum to search for all available packages related to your keyword.

yum search CHANGETHIS

If you are searching for an application related to the Vim editor, with the name you specified, e.g. to find all packages related to Vim editor, you will use the following yum search command:

yum search vim

yum_search_vim.png

Yum also allows you review information on an application by using the info command.

yum info CHANGETHIS

If you need information on your server Nano editor you will use the following command:

yum info nano

yum_info_nano.png

Yum can also be used to install different packages onto your server. If you want to install a specific application you will use the following yum command:

yum install CHANGETHIS

A good example of this command will be if you need to install the htop process monitor on your server, you would use the yum command:

yum install htop

yum_install_htop.png

Often applications need to have several different packages installed to work correctly. To save time from having to install them one-by-one, yum allows you to use the groupinstall command.

yum groupinstall “CHANGETHIS”

This is often used to install MySQL on the server. If you need to install MySQL you will use the following yum command:

yum groupinstall “MySQL”

Updating software with yum

In order to update an application  to the latest available version using yum, you would use the update command:

yum upgrade CHANGETHIS

If you need to update grep, you will use the following command to update it using yum:

yum update grep

yum_update_grep.png

Please be aware that if a piece of software is in use when it is updated by yum, the old version will remain active until the application or service is restarted. All kernel updates take effect when you reboot the system.

Yum also allows you the ability to update all packages used by a specific application. If you need to update all aspects of an application, you will use the groupupdate command:

Yum groupupdate “CHANGETHIS”

Often this is command needed to update MySQL. If you need to update MySQL on your system you will use the yum command:

yum groupupdate "MySQL"

Yum also allows you to update all installed applications on your server. To perform a full update, you would use the yum command:

yum update

The update command will check all installed applications and then compare them with the current versions in repositories and then provide a full list of applications that need to be upgraded.

yum_update.png

Listing and removing installed packages

The yum list command provides you information on packages, package groups, and repositories. Results of any of the yum list commands can be filtered depending on one or more arguments.

To run a full list of all installed and available applications, you would run the following yum command:

yum list all

If you need to see a full list of all installed packages currently on your server, you will use the yum command:

yum list installed

yum_list_installed.png

You can also view a full list of package groups using yum. The yum command to review the list would be as follows:

yum grouplist

yum_grouplist.png

To remove software, yum examines the system for both the specified software and any software which claims it as a dependency. The transaction to remove the software deletes both the software and the dependencies.

Please beware that removing software pieces from your server should only be removed it absolutely needed. Please remember, that when deleting applications from your server, crucial parts of your system may be deleted and/or break how the server functions.

If you need to remove a program, you will use the yum command:

yum remove CHANGETHIS

A good example of this command in action would be if you had to remove the nano editor package. To remove this package, you would use the following yum command:

yum remove nano

yum_remove_nano.png

Yum also allows you the full ability to a group of packages from your system. To remove a group package, you would use the command:

yum groupremove ‘Web Server’

If you needed to remove the web server application from your system, you would use the yum command:

yum groupremove ‘Web Server.'

Common stand-alone web/db/mail configs and log files locations

Web logs and file location

Apache is a web server that is typically used on CentOS and writes to a high number of log
files. Each site on the server contains their own traffic log. To log all http
requests for a website the access_log is used. The direct path would be as follows:

/var/log/httpd/access_log

To view the access_log, you would use the tail command inside your terminal client. The tail command provides you in your PuTTY window the last 10 lines of the file. To view the file using the tail command, use the following command in PuTTY:

tail /var/log/httpd/access_log

If more information is needed on a specific error displayed on your site, Apache writes all errors to the same error_log file on your system. The error_log can be found in the following location:

/var/log/httpd/error_log

error_log.png

Apache stores the main configuration file of the web server in the following location:

/etc/httpd/conf/httpd.conf

MySQL logs and config file location

MySQL servers by default store the configuration file at the following path:

/etc/my.cnf

If you have installed MySQL someplace other thеn the default location, you сan run the following command to locate it on your system:

/usr/libexec/mysqld --help --verbose | less

mysql_config_files.png

After inserting this command, your PuTTY window will be flooded with a lot of text. The first section of text describes the options you can send to the server when you launch it. The second set of text is part of the server configuration created when the server was compiled. To locate your MySQL configuration file, you will require information near the start of the output. The lines of text will look like this but may not be exactly the same as the information listed below.

Default options are read from the following files in the given order:

/etc/my.cnf ~/.my.cnf

File /etc/mysql/my.cnf does not exist by default so all configuration parameters are located inside /etc/my.cnf

Default MySQL logs location:

/var/lib/mysql/{SERVER_NAME}.err

If your server hostname is cloud.mydomain.com, your file would be named as follows:

/var/lib/mysql/cloud.mydomain.com.err

Mail logs and config file location

Exim uses three main log files, but only two of the files contain useful information. The exim_mainlog contains all incoming and outgoing interactions handled by. The exim_mainlog file is located at the following location:

/var/log/maillog

mail_log.png

Exim store all information related to its configuration in the /etc folder. The Exim configuration file is typically located here:

/etc/exim/exim.conf

If you need to review any of these two exim log files, they can be viewed using any standard text editor.

Was this article helpful?

Yes (3)
No (0)

We're sorry you didn't find this article very helpful. Please help us improve it by leaving your feedback below.

Error