In the world of software development, DevOps is a term that is often used to describe a methodology that emphasizes collaboration and communication between software developers and IT operations professionals. The goal of DevOps is to create a more streamlined and efficient development process that allows for faster and more reliable software releases.
At its core, DevOps is all about breaking down the barriers that exist between development and operations teams. Traditionally, these two teams have operated independently of one another, which can create bottlenecks and delays in the software development process. DevOps seeks to overcome these challenges by encouraging collaboration, sharing of knowledge, and the use of automation tools.
One of the key benefits of DevOps is that it allows for faster and more frequent software releases. By using automation tools to manage the software delivery pipeline, developers can quickly deploy new code changes to production environments, allowing for more rapid iteration and feedback. This can help to reduce the time-to-market for new features and products, which can be a critical competitive advantage in many industries.
Another important aspect of DevOps is the emphasis on continuous improvement. By constantly monitoring and measuring the performance of software systems, DevOps teams can identify areas for improvement and implement changes that lead to better outcomes. This iterative approach to development can help to create more reliable and stable software systems over time.
To be successful with DevOps, organizations must be willing to invest in the necessary infrastructure, tools, and processes. This includes things like automation tools for testing, deployment, and monitoring, as well as training and support for team members who are new to the DevOps methodology.
Overall, DevOps is a powerful approach to software development that can help organizations to create more efficient and effective development processes. By emphasizing collaboration, automation, and continuous improvement, DevOps teams can deliver higher-quality software products in less time, ultimately driving greater business success.
Migrating a WordPress site from one host to another can be a daunting task, but it’s sometimes necessary to ensure your website is running smoothly and securely. There are several reasons why you might consider migrating your WordPress site, such as poor website performance, unreliable hosting, or the need for more resources or features.
When it comes to migrating a WordPress site, there are two primary methods: manual migration and plugin migration. Manual migration involves transferring all of the files and database from one host to another manually, while plugin migration involves using a plugin to transfer the files and database.
Manual migration is generally preferred for larger or more complex sites that may not be easily migrated using a plugin, and it gives you more control over the migration process. On the other hand, plugin migration is usually faster and easier, making it a good option for smaller websites or those without a lot of technical expertise.
Regardless of the method you choose, it’s important to ensure that your website is fully backed up before migrating to avoid any potential data loss or other issues. Additionally, it’s a good idea to test your website thoroughly after the migration to ensure everything is working as expected.
How to Migrate Your WordPress Site Manually
It is advisable to have an understanding of the WordPress migration process, even if you are utilizing a plugin for the migration of your website. Following the steps for migrating a WordPress website manually from one host to another.
Step 1: Set up your new host
Selecting a trustworthy website host is essential. You can opt for a reputable shared hosting provider or choose to have your own server based on your needs. Shared hosting includes all necessary web hosting tools and software already installed, while for VPS or Dedicated servers, you will need to install and set up WordPress hosting on the server.
Step 2: Backup your website files and database Before starting the migration process, it’s important to make a backup of your website files and database. This will ensure that you have a copy of your website in case anything goes wrong during the migration process.
To create a backup of your website, you can use a plugin like UpdraftPlus or manually download your website files via FTP or file manager, and your database using phpMyAdmin. If you possess SSH access to the host, you can also utilize zip or tar to compile the files and download them. Furthermore, you can utilize the mysqldump command to create backups of your database.
Step 3: Transfer your website files
After setting up your new host, you can transfer your website files from your old host to your new host. To do this, connect to your old host using an FTP client and download your website files. Then, connect to your new host using the same FTP client and upload your website files to the appropriate folder.
Step 4: import your database
Next, you’ll need to export your website database from your old host and import it into your new host. To do this, log in to your new host’s phpMyAdmin, select your new database, and choose the “Import” option. Upload the exported database file from your computer and import it into your new database. If you have SSH access to the new host, then you may use “mysql” command line utility to import the database backup sql files.
Step 5: Update your website configuration
After transferring your website files and database, you’ll need to update your website configuration to point to your new host. To do this, open your wp-config.php file on your new host and update the database settings with your new database name, username, and password. Here are the three lines you’ll normally need to update:
If your new databases are hosted on another host, you will have to update the “DB_HOST” section also.
If you are changing the WordPress domain url, you may also need to update your website URLs in your WordPress database using a tool such as the Better Search Replace plugin. This will ensure that your website links and URLs are updated to point to your new host.
Step 6: Test your website and Change DNS.
Finally, you’ll need to make sure your Domain Name Server (DNS) is pointed toward the correct host. It’s important to test your website on your new host to ensure everything is working correctly. Check your website’s pages, posts, media files, and any other features make sure they’re all functioning properly.
If you encounter any issues, refer to your backup files and try to troubleshoot the issue. Once you’ve confirmed that everything is working correctly, you can cancel your old hosting account.
How to Migrate Your WordPress Site With a Plugin
Using a migration plugin can save you a significant amount of time and effort, as it automates many of the technical steps involved in migrating your site. With a good migration plugin, you can quickly and easily move your entire website to a new server or domain without worrying about the complexities of manually transferring files and databases.
Overall, migrating a WordPress site can be a complex process, but with the right preparation and tools, you can ensure a successful migration that keeps your website running smoothly and securely.
Step 1: Choose a migration plugin
There are many migration plugins available for WordPress, both free and paid. Some of the popular ones include Duplicator, All-in-One WP Migration, and WPvivid Backup Plugin. For this tutorial, we’ll be using the All-in-One WP Migration plugin.
Step 2: Install the plugin
To install the All-in-One WP Migration plugin, log in to your WordPress dashboard and go to Plugins > Add New. Search for “All-in-One WP Migration”, install and activate the plugin.
Step 3: Export your WordPress site
Once you’ve installed and activated the plugin, go to All-in-One WP Migration > Export. This will create a backup of your WordPress site, including all your posts, pages, media files, plugins, themes, and the database. The backup will be saved as a downloadable file.
Step 4: Import your WordPress site
Next, you install fresh WordPress on your new hosting provider. You’ll need to import the backup file to your new WordPress site. Install and activate the All-in-One WP Migration plugin on your new site, and go to All-in-One WP Migration > Import. Upload the backup file you created in Step 3.
The plugin will then import all the data from the backup file, including the database, plugins, themes, posts, pages, and media files. Once the import is complete, you’ll have a fully functional WordPress site on your new server.
Step 5: Update your website URL
After migrating your WordPress site, you’ll need to update your website URL to reflect your new domain. Go to Settings > General in your WordPress dashboard and update the WordPress Address (URL) and Site Address (URL) fields to your new domain.
Step 6: Test your website
Finally, test your website to make sure everything is working properly. Check all the pages and posts, and make sure all the links are working. You may also want to check your website’s performance and ensure that it’s running smoothly.
Best plugins for WordPress migration
There are several great migration plugins available for WordPress. Here are some of the most popular ones:
1. Duplicator: Duplicator is a free migration plugin that allows you to backup, transfer, and migrate your WordPress site. It’s easy to use and has a user-friendly interface.
2. All-in-One WP Migration: All-in-One WP Migration is another popular migration plugin that lets you export your entire WordPress site, including the database, plugins, themes, and media files, and import it to a new server or domain.
3. WPvivid Backup Plugin: WPvivid Backup Plugin is a comprehensive backup and migration plugin that allows you to backup and restore your WordPress site, as well as transfer it to a new server or domain.
4. UpdraftPlus: UpdraftPlus is a backup and migration plugin that allows you to backup your WordPress site and transfer it to a new server or domain. It also has a paid version with additional features.
5. Jetpack: Jetpack is a popular WordPress plugin that offers a suite of features, including backup and migration tools. It’s an all-in-one solution that includes security, performance, and marketing tools, making it a great choice for website owners who want an all-in-one solution.
These are just a few examples of the many great migration plugins available for WordPress. The best migration plugin for you will depend on your specific needs and budget. It’s always a good idea to research different plugins and read reviews before choosing one to ensure it meets your requirements.
In summary, migrating a WordPress site from one host to another can be necessary for a variety of reasons, such as poor website performance or unreliable hosting. There are two primary methods for migrating a WordPress site: manual migration and plugin migration. Manual migration is preferred for larger or more complex sites, while plugin migration is usually faster and easier for smaller sites or those without a lot of technical expertise. Regardless of the method chosen, it’s important to backup the website fully before migrating and to thoroughly test the website after the migration to ensure everything is working as expected. With the right preparation and tools, a successful migration can ensure a website runs smoothly and securely on a new host.
How to remove or compress huge MySQL general and query log table
If you have enabled MySQL general or slow logging, it can create quite big log, depending upon your MySQL usage/queries. So we may have to periodically clear them to save space.
Please note that MySQL can save logs to either table or files. This document assumes you are using table as log output.
Files: slow_log.CSV and general_log.CSV (The location and the name of the file can be different)
By default, logging is to CSF file.
MYSQL supports run time clearing of these logs. So no need to restart the MySQL service. Never delete the CSV file directly. It can crash MySQL.
Slow query log
SET GLOBAL slow_query_log='OFF';
DROP TABLE IF EXISTS slow_log2;
CREATE TABLE slow_log2 LIKE slow_log;
RENAME TABLE slow_log TO slow_log_backup, slow_log2 TO slow_log;
gzip /var/db/mysql/mysql/slow_log_backup.CSV
DROP TABLE slow_log_backup;
SET GLOBAL slow_query_log = 'ON';
General log
USE mysql;
SET GLOBAL general_log = 'OFF';
DROP TABLE IF EXISTS general_log2;
CREATE TABLE general_log2 LIKE general_log;
RENAME TABLE general_log TO general_log_backup, general_log2 TO general_log;
gzip /var/db/mysql/mysql/general_log_backup.CSV
DROP TABLE general_log_backup;
What we did is create new log table, move current log file to a backup copy and compress the backup and remove it.
phpMyAdmin is installed with CentOS Web Panel. By default, it is not protected and there is only MySQL user authentication. This can put your server vulnerable. So it is recommended to add additional layer protection.
phpMyAdmin is available through the following url in a CWP based server.
http:/hostname/phpmyadmin http:/hostname:2030/pma
CWP panel runs its core services through its own version of Nginx. So normal htaccess based password protection will not work.
Create the Password File
You can do this by using the OpenSSL utilities that may already be available on your server. Alternatively, you can use the purpose-made htpasswd utility included in the apache2-utils package(Debian/ubuntu) or httpd-tools(Redhat/Centos).
Using OpenSSL Utilities
We will create a hidden file called .pma_pass /usr/local/cwpsrv/var/services/ folder. You can use any username. I am using dbadmin here as an example
sudo sh -c "echo -n 'dbadmin:' >> /usr/local/cwpsrv/var/services/.pma_pass"
Next, add an encrypted password entry for the username by typing:
sudo sh -c "openssl passwd -apr1 >> /usr/local/cwpsrv/var/services/.pma_pass"
Using Apache Utilities
This tool is already installed and available on all CWP servers.
We will need to configure Nginx to read this file before serving our protected content. CWP Service Nginx configuration file: /usr/local/cwpsrv/conf/cwp_services.conf
Open the above file add the following to the location block of phpMyAdmin.
To confirm that your content is protected, try to access your restricted content in a web browser. You should be presented with a username and password prompt
How to block Outgoing Port 25 for all VPS/Containers of SolusVM(Both OpenVZ/KVM)
Sometimes,when providing VPS service, it is necessary to block mailing service for VPS. Otherwise your IP ranges will be blocked by RBLs and other common mail providers like Gmail, Hotmail, AOL, etc. It is recommended to open ports by case by case for your customers, after establishing trust with your client.
Normally we block the port using the “OUTPUT” chain. However, SolusVM uses the chain “FORWARD” for routing traffic from containers/VPSs.
So by adding following rules, you can block all outgoing mails ports completely for all VPSs. iptables -I FORWARD -d 0.0.0.0/0 -p tcp -m tcp --dport 25 -j DROP iptables -I FORWARD -d 0.0.0.0/0 -p tcp -m tcp --dport 465 -j DROP iptables -I FORWARD -d 0.0.0.0/0 -p tcp -m tcp --dport 587 -j DROP
Ajenti is an open source, web-based control panel that can be used for a large variety of server management tasks. Optionally, an add-on package called Ajenti V allows you to manage multiple websites from the same control panel
Step 1: First make sure that all your system packages are up-to-date sudo apt-get update sudo apt-get upgrade
Step 2: Installing Ajenti Control Panel. wget -O- https://raw.github.com/ajenti/ajenti/1.x/scripts/install-ubuntu.sh | sudo sh
Anjeti will be available on HTTP port 8000 by default. Open your favourite browser and navigate to http://yourdomain.com:8000 or http://server-ip:8000 and enter default username “admin” or “root” and password is “admin”.
Change the password immediately to something secure.
How To Install PHP 7 On A cPanel/WHM Server With EasyApache 3
Latest versions of cPanel come with EasyApache 4 which provides lots of new features like native support for multiple PHP versions, PHP 7 support, very fast, etc. So it is recommended to migrate to EasyApache 4. However, if you cannot migrate EasyApache 4 because of some reason (Example: Tomcat support), you will have to compile the PHP 7 manually from source.
To migrate to EasyApache for, just run the below command. cPanel will try to build a matching PHP setup using EasyApache 4.
/scripts/migrate_ea3_to_ea4 --run
If anything goes wrong during the upgrade process you can always go back with /scripts/migrate_ea3_to_ea4 –revert –run
Manually install PHP 7
Following steps are tested with cPanel 11.64.0.36 and CentOS 6.9 64 bit. The PHP handler should be suphp to get this working.
cd /usr/local/src/
wget http://php.net/distributions/php-7.0.22.tar.gz #Go to php.net site to find the latest version
tar xvf php-7.0.22.tar.gz
You may add any additional parameters required. You can run ./configure --help to see all available options first. Important: Do not forget to set the "--prefix=/usr/local/php70". Otherwise, your existing PHP installation will be lost.
make
make install
If everything is successful, the PHP binaries will be installed in "/usr/local/php70/bin/" directory.
Edit the /opt/suphp/etc/suphp.conf and add below code, at the end of the handlers list to enable PHP7 handler.
;Handler for php-scripts #... existing handlers are here ... put yours below them application/x-httpd-php7="php:/usr/local/php70/bin/php-cgi"
Now add our custom php config file to EasyApache list so that the changes will not be lost future EasyApache builds.
There are two options here. You can either go into WHM and edit the post_virtualhost_global.conf file from there or you just run: vi /usr/local/apache/conf/includes/post_virtualhost_global.conf. Add the line below in that file and you should be all done.
Include /usr/local/apache/conf/php70.conf
Now restart Apache
service httpd restart
Configure a website To Use This new PHP 7 Add following code to .htaccess file(/home/username/public_html/.htaccess) AddType application/x-httpd-php7 .php7 .php
#Open the incoming TCP port 5666 on your firewall. You will have to do this using firewall software, like firewall ufw.
#Update Configuration File The file nrpe.cfg is where the following settings will be defined. It is located:
/usr/local/nagios/etc/nrpe.cfg
allowed_hosts=
At this point NRPE will only listen to requests from itself (127.0.0.1). If you wanted your nagios server to be able to connect, add it's IP address after a comma (in this example it's 10.25.5.2):
allowed_hosts=127.0.0.1,10.25.5.2
The following commands make the configuration changes described above.
sudo sh -c "sed -i '/^allowed_hosts=/s/$/,10.25.5.2/' /usr/local/nagios/etc/nrpe.cfg" sudo sh -c "sed -i 's/^dont_blame_nrpe=.*/dont_blame_nrpe=1/g' /usr/local/nagios/etc/nrpe.cfg"
#Start Service / Daemon
Different Linux distributions have different methods of starting NRPE.
Ubuntu 13.x / 14.x
sudo start nrpe
Ubuntu 15.x / 16.x / 17.x
sudo systemctl start nrpe.service
Test NRPE
Now check that NRPE is listening and responding to requests.
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
You should see the output similar to the following: NRPE v3.2.0
If you get the NRPE version number (as shown above), NRPE is installed and configured correctly.
You can also test from your Nagios host by executing the same command above, but instead of 127.0.0.1 you will need to replace that with the IP Address / DNS name of the machine with NRPE running.
Service / Daemon Commands
Different Linux distributions have different methods of starting / stopping / restarting / status NRPE.
NRPE needs plugins to monitor different parameters. T
#Install Latest Nagios plugins
cd /usr/local/src/ wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz tar zxf nagios-plugins.tar.gz cd nagios-plugins-release-2.2.1/ ./tools/setup ./configure --enable-perl-modules make make install
#Test NRPE + Plugins
Using the check_load command to test NRPE: /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_load
You should see the output similar to the following: OK - load average: 0.01, 0.13, 0.12|load1=0.010;15.000;30.000;0; load5=0.130;10.000;25.000;0; load15=0.120;5.000;20.000;0;
You can also test from your Nagios host by executing the same command above, but instead of 127.0.0.1 you will need to replace that with the IP Address / DNS name of the machine with NRPE running.
From version 56, cPanel provides API support to disable email service for domain or email accounts. Please note this limit cannot be override by the user from their cPanel. This can be very helpful if there is any spamming activity and you just want to disable the email service feature for the domain for the time being.
You can run the below commands through SSH console
To suspend email service for a the cPanel user “aacenyor”
whmapi1 suspend_outgoing_email user=aacenyor
For unsuspending the account, please run the below command:
whmapi1 unsuspend_outgoing_email user=aacenyor
If you are not comfortable with SSH, you can also call these through browser XML.
Example:
To suspend https://hostname.example.com:2087/cpsess##########/xml-api/suspend_outgoing_email?api.version=1&user=aacenyor
where replace hostname.example.com with your hostname replace cpsess########## with WHM session id.
To un suspend https://hostname.example.com:2087/cpsess##########/xml-api/unsuspend_outgoing_email?api.version=1&user=aacenyor
For older versions cPanel, you may refer to this below forum from cPanel. There is a workaround
If you receive following error while logging to the Plesk panel, that means there is a IP based restriction to access Plesk admin panel and your current IP is not allowed to access.
“Unable to log into Plesk: Access for administrator from address xx.xx.xx.xx is restricted in accordance with IP Access restriction policy currently applied”
Cause Plesk IP access policy was configured in such a way so that Plesk could not be accessed from the certain IP.
Resolution
Method 1. To enable Plesk access, you need to log into the Plesk from another IP and change the IP access policy:
Tools and Settings > Restrict Administrative Access Add your IP to the whitelist
Method 2. Updating the database directly
If you cannot login to the panel, then you can connect to the server using SSH and correct this through database queries. Plesk database records regarding the access policy need to be corrected.
To retrieve the current policy and the restricted/allowed IPs, the following commands can be used:
Linux
#MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa
mysql> select * from cp_access;
mysql> select * from misc where param='access_policy';
Windows
"%plesk_bin%\dbclient" --direct-sql --sql="select * from cp_access"
"%plesk_bin%\dbclient" --direct-sql --sql="select * from misc where param='access_policy'";
If you wish to clear the access policy settings, remove all records from “cp_access” and set the policy to “allow”:
Linux
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa
mysql> delete from cp_access;
mysql> update misc set val="allow" where param='access_policy';
Windows
"%plesk_bin%\dbclient" --direct-sql --sql="delete from cp_access";
"%plesk_bin%\dbclient" --direct-sql --sql="update misc set val='allow' where param='access_policy'";
To whitelist the IP manually
bash# mysql -uadmin -p`cat /etc/psa/.psa.shadow ` psa
insert into cp_access values ("", "deny", "x.x.x.", "255.255.255.255"); //change the IP address to your public IP.
Then you should be able to connect to the Plesk control panel from the new IP address.