picatz / goldengirl

✨ All that shimmers is gold!
MIT License
3 stars 0 forks source link

document general centos 7 administration #54

Open picatz opened 6 years ago

picatz commented 6 years ago

Like what package manager, how to start and stop services with systemd. Tips and tricks.

malwaremily commented 6 years ago

Package Manager

YUM - Yellowdog Updater, Modified

Search through available packages: yum search PACKAGE_NAME

"yum search looks at the following metadata fields: name, summary, description, url."

You can list multiple terms and yum search will list relevant packages by term combination and relevance. yum search PACKAGE_NAME PACKAGE_NAME ...

You can get more information about a package: yum info PACKAGE_NAME

Install a package: sudo yum install PACKAGE_NAME

View installed packages: yum list installed

Remove a package: sudo yum remove PACKAGE_NAME

Clear yum cache: yum clean all "During its normal use yum creates a cache of metadata and packages. This cache can take up a lot of space. The yum clean command allows you to clean up these files. All the files yum clean will act on are normally stored in /var/cache/yum."

Examples:

yum search python rsync ssh yum info rdiff-backup sudo yum install rdiff-backup sudo yum remove rdiff-backup

Sources: https://wiki.centos.org/PackageManagement/Yum http://yum.baseurl.org/wiki/YumCommands

malwaremily commented 6 years ago

systemd & systemctl

Starting and Stopping Services

 start service   - `sudo systemctl start service`
 stop service    - `sudo systemctl stop service`
 restart service - `sudo systemctl reload-or-restart service` 

Running Services at Boot

sudo systemctl enable application.service

"This command creates a symoblic link from the system's copy of the service file (typically found in /lib/systemd/system or /etc/systemd/system) into the location on disk where systemd looks for autostart files (typically /etc/systemd/system/some_target.target.wants)"

To disable a service from running automatically

sudo systemctl disable application.service

This removes the symbolic link that indicated the service should be started automatically.

Checking the Status of Services

systemctl status application

This will provide you with information like service state, PID, memory, the cgroup hierarchy, and the first few log lines.

You can also check specific states:

Sources and more information: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units https://en.wikipedia.org/wiki/Systemd