Discover DevOps roles and learn Linux from basics to advanced at DevOpsRoles.com. Detailed guides and in-depth articles to master Linux for DevOps careers.
In this tutorial, How to install Let’s Encrypt SSL on CentOS 7. Let’s Encrypt is a free, automated TLS/SSL certificate web server. In the previous post, I have installed Let’s Encrypt SSL on Centos 6 here.
# Setting up crontab
crontab -e
# Append the below line to the end of crontab
0 0 * * * /usr/local/sbin/certbot-auto renew --renew-hook "/sbin/service nginx reload" --quiet --agree-tos
Authentication information generated by the following method
echo -n 'admin:admin123123' | openssl base64
Output
YWRtaW46YWRtaW4xMjMxMjM=
Get the required packages from a repository on the Internet via the Nexus3 proxy repository. By acquiring via the proxy repository, it is automatically saved to Nexus3 as well as downloaded.
[root@DevopsRoles ~]# cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
Install Nexus Repository OSS on Centos 7
# Creating necessory folder structure
mkdir -p /Data/nexus-data /opt/nexus
# Download latest Nexus artifact
wget -O /tmp/nexus.tar.gz http://download.sonatype.com/nexus/3/latest-unix.tar.gz
# Extract it to /opt/nexus
tar xvfz /tmp/nexus.tar.gz -C /opt/nexus --strip-components 1
# Adding a service account for nexus
useradd --system --no-create-home nexus
# Provide necessory folder permissions
chown -R nexus:nexus /opt/nexus
chown -R nexus:nexus /Data/nexus-data
Configure environment for Nexus repository OSS on CentOS 7
# Setting up the default JDK
alternatives --config java
# Setting up JAVA_HOME and NEXUS_HOME
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64
export NEXUS_HOME=/opt/nexus
source /etc/bashrc
# Check the JAVA version
java -version
You have to Install Nexus Repository OSS and configure Nexus Repository OSS on CentOS 7. I hope will this your helpful. Thank you for reading the DevopsRoles page!
In this tutorial, How to Change WordPress URLs in MySQL Database using the command line. WordPress uses the MySQL database to store all its data, including site URLs.
Determining the Name of WordPress MySQL Database
WordPress stores the MySQL database name and its credentials in the wp-config.php file. Example below
[devopsroles@server1 ~]$ egrep -A 10 DB_NAME /Wordpress/web/wp-config.php
define('DB_NAME', 'wordpressdb');
/** MySQL database username */
define('DB_USER', 'HuuPV');
/** MySQL database password */
define('DB_PASSWORD', 'devopsroles.com');
/** MySQL hostname */
define('DB_HOST', 'localhost');
Change WordPress URLs
I will change from the Old site:https://linuxoperatingsystem.net to the New site: http://192.168.122.229
Determining the site URL currently with the command below
mysql> SELECT * FROM wp_options WHERE option_name='siteurl';
+-----------+-------------+----------------------------------+----------+
| option_id | option_name | option_value | autoload |
+-----------+-------------+----------------------------------+----------+
| 1 | siteurl | https://linuxoperatingsystem.net | yes |
+-----------+-------------+----------------------------------+----------+
1 row in set (0.00 sec)
mysql>
Command-line change WordPress URLs in MySQL Database
mysql -u root -p Database_Name
mysql> UPDATE wp_options SET option_value = replace(option_value, 'https://linuxoperatingsystem.net', 'http://192.168.122.229') WHERE option_name = 'home' OR option_name = 'siteurl';
mysql> UPDATE wp_posts SET guid = replace(guid, 'https://linuxoperatingsystem.net','http://192.168.122.229');
mysql> UPDATE wp_posts SET post_content = replace(post_content, 'https://linuxoperatingsystem.net', 'http://192.168.122.229');
mysql> UPDATE wp_postmeta SET meta_value = replace(meta_value,'https://linuxoperatingsystem.net','http://192.168.122.229');
If you’re managing a WordPress site, you may find yourself needing to change the URLs directly in the MySQL database, especially after a migration or domain change. This process involves accessing your MySQL database through a command line interface and using SQL commands to update the site URL across different tables such as wp_options, wp_posts, and wp_postmeta. It’s a crucial skill for maintaining the integrity of your WordPress site links. Always back up your database before making such changes to avoid any potential data loss. For detailed guidance, consider visiting DevOpsRoles for tutorials.
In this tutorial, I lost the admin password WordPress. How to reset admin password WordPress. Did you forget your WordPress admin password? Don’t worry; it happens to the best of us. Thankfully, resetting your admin password is a straightforward process.
How to reset admin password WordPress
You’ve logged into the MySQL database server as the root user and you’re trying to access the wordpressdbdatabase. Here are the steps you’ve taken, For Example, I will use wordpressdb database.
[root@server1 ~]# mysql -u root -p
mysql> show databases;
mysql> use wordpressdb;
The output is below
[root@server1 ~]# mysql -u root -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| wordpressdb |
+--------------------+
5 rows in set (0.01 sec)
mysql> use wordpressdb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql>
In this tutorial. How to install pip on Centos 8. Pip is a package management system that allows you to install, remove, and otherwise manage software packages written in Python.
How to Install PIP on Centos 8
Two Python versions are Python 2 and Python 3.
Install pip3 for Python 3
sudo dnf install python3
The output is as below:
[devopsroles@server1 ~]$ sudo dnf install python3
[sudo] password for devopsroles:
Last metadata expiration check: 0:07:32 ago on Wed 02 Sep 2020 09:15:00 PM +07.
Dependencies resolved.
==========================================================================================================
Package Architecture Version Repository Size
==========================================================================================================
Installing:
python36 x86_64 3.6.8-2.module_el8.1.0+245+c39af44f AppStream 19 k
Installing dependencies:
python3-pip noarch 9.0.3-16.el8 AppStream 19 k
python3-setuptools noarch 39.2.0-5.el8 BaseOS 162 k
Enabling module streams:
python36 3.6
Transaction Summary
==========================================================================================================
Install 3 Packages
Total download size: 201 k
Installed size: 466 k
Is this ok [y/N]: y
Downloading Packages:
(1/3): python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64.rpm 7.3 kB/s | 19 kB 00:02
(2/3): python3-pip-9.0.3-16.el8.noarch.rpm 7.1 kB/s | 19 kB 00:02
(3/3): python3-setuptools-39.2.0-5.el8.noarch.rpm 52 kB/s | 162 kB 00:03
----------------------------------------------------------------------------------------------------------
Total 43 kB/s | 201 kB 00:04
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : python3-setuptools-39.2.0-5.el8.noarch 1/3
Installing : python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64 2/3
Running scriptlet: python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64 2/3
Installing : python3-pip-9.0.3-16.el8.noarch 3/3
Running scriptlet: python3-pip-9.0.3-16.el8.noarch 3/3
Verifying : python3-pip-9.0.3-16.el8.noarch 1/3
Verifying : python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64 2/3
Verifying : python3-setuptools-39.2.0-5.el8.noarch 3/3
Installed:
python3-pip-9.0.3-16.el8.noarch python3-setuptools-39.2.0-5.el8.noarch
python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64
Complete!
Check version pip
pip3 --version
The output as below
[devopsroles@server1 ~]$ pip3 --version
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
To install and build Python modules with pip, you need to install the Development tools:
Typically, you should use pip inside a virtual environment only. It is used when separating the Python execution environment, such as when you want to change the Python execution environment for each project or you do not want to keep the local environment dirty venv.
In this section, we will go through several basic pip commands.
To install a package
pip install flask
If you want to install a specific version of the package
pip install flask==1.0.0
Uninstall a package
pip uninstall package_name
Search packages
pip search "package_name"
View the full list of packages
pip list
List outdated packages:
pip list --outdated
To upgrade an already installed package
pip3 install --upgrade package_name
Check pip dependencies
pip check
List of packages that need updating
pip list -o
Show packages by package name == version
pip freeze
Useful when outputting to requirements.txt
pip freeze > requirements.txt
Package update
pip install -U package_name
Update pip itself
pip install -U pip
Checking the details of the package
pip show package-name
Conclusion
How to install pip on CentOS 8 and how to easily install and uninstall Python modules with pip. Thank you for reading the DevopsRoles page!
When launching a new server with CentOS 8, ensuring a secure and properly configured foundation is essential. Whether you’re setting up a VPS for the first time or deploying infrastructure for production, a systematic initial server setup will help harden your system and prepare it for future installations. In this guide, we’ll walk through the essential steps to Initial Server Setup CentOS 8 server – from creating a non-root sudo user to configuring your firewall and installing core utilities.
Update Your System
Before any configuration, ensure that your system is up to date. This not only secures your server but also ensures compatibility with future installations:
sudo dnf update -y
sudo dnf upgrade -y
Create a Sudo User and Granting Administrative Privileges
By following this initial server setup guide for CentOS 8, you’ve established a secure and functional baseline for your system. Creating a non-root user with sudo privileges, securing SSH access, enabling the firewall, and installing essential tools are critical steps to ensure stability, security, and readiness for production workloads. With this solid foundation, you’re now well-prepared to deploy applications, configure services, or automate infrastructure tasks confidently.
For ongoing security, remember to regularly update your system and monitor user access and services. If you’re planning to install a web server, database, or other services next, this setup ensures you start from a well-configured environment. I hope will this your helpful. Thank you for reading the DevopsRoles page!
In this tutorial, I will witten about RabbitMQ: Install, configuration, and example. RabbitMQ is a message broker, written in Erlang. Now, let’s go to the RabbitMQ tutorial for beginners.
It is transferring data ( messages) between several services: one service adds a message to the queue, the other receives these messages.