Category Archives: Ubuntu

The mysql.session exists but is not correctly configured

One of our MySQL server(5.5.x) crashed but fortunately we have setup the backup of it. I have built the new server with MySQL(5.7.34) and restored the backup on it but when I tried to run any query like creating new user(s) etc got an error something like:

ERROR 1728 (HY000): Cannot load from mysql.db. The table is probably corrupted

This happens due to the schema changes required for different MySQL server versions. The simple fix to this problem recommended by MySQL is to run the mysql_upgrade command from the command line.
mysql_upgrade checks all tables across all databases for incompatibilities with the current version of MySQL. mysql_upgrade also upgrades the system tables so that we can take advantage of new privileges or capabilities that might have been added. It supersedes the older mysql_fix_privilege_tables script, which should no longer be used.

[IMPORTANT NOTE] Before running mysql_upgrade command on production server, it’s always a good practice to take a full backup of all the databases first, just in case something goes wrong.

I tried to run mysql_upgrade command from terminal:

mysql_upgrade -uroot -p

After entering the command, got this error message:

Note: I am not mentioning mysql username and password in the command because I am using .my.cnf configuration

mysql_upgrade will perform a weaker verification. If the result is not equal to 1, then mysql_upgrade cannot be executed.

Read more of this post

RabbitMQ Clustering on AWS using Ansible

In this short post, I’ll show you the steps to configure the RabbitMQ clustering on AWS using Ansible. We decided to use the RabbtiMQ instead of AWS SQS because we want better performance and also require some flexibility.

In this setup, we have created 3 EC2 servers(Ubuntu 14.04 LTS) and 1 classic ELB on AWS. Clients both providers and consumers connect to the RabbitMQ servers through ELB, so system will be functional even one or more server will be down in other words system will be operational as long as one of the server is running.

RabbitMQ Requirement(Copied from official RabbitMQ Site):

RabbitMQ nodes address each other using domain names, either short or fully-qualified (FQDNs). Therefore hostnames of all cluster members must be resolvable from all cluster nodes, as well as machines on which command line tools such as rabbitmqctl might be used.

Hostname resolution can use any of the standard OS-provided methods:
DNS records
Local host files (e.g. /etc/hosts)

Settings on AWS: Read more of this post

Jenkins Installation and GitHub OAuth Integration using Ansible

In this tutorial, we’ll use Ansible to automate the installation of Jenkins CI on a fresh Ubuntu 14.04 LTS and integrate it with the GitHub OAuth. Ansible will also assign the matrix based permission on the Jenkins like which github user or group(s) have what rights on the Jenkins. Beside that, it will also install the Apache which serves as frontend for all the Jenkins requests.

In short, in this tutorial we’ll do the following tasks using Ansible:

  • Install the JAVA 7
  • Install the mentioned version of Jenkins(in this case it will be 1.658)
  • Install the desired plugins
  • Install the Apache and configure it as frontend for Jenkins
  • Install the SSL certificate for Apache Virtual Host that act as frontend for Jenkins
  • Integrate the Jenkins with GitHub using OAuth for Authenication
  • Configure the matrix based security using the github username or group

Read more of this post

Ansible role to create linux users with Github accounts ssh key

In this short tutorial we’ll learn how to create or delete the linux user accounts with public ssh keys associated with their Github accounts using Ansible, so please create a Github account if you don’t already have one, and follow the instructions for associated SSH keys with your account, if you didn’t perform it already.

First, download this Repository from the GitHub:

git clone https://github.com/arbabnazar/ansible-roles.git

Note: If git is not installed then you can simply download the zip file.

Move inside the cloned directory:

cd ansible-roles

Read more of this post

How to compile a development version of Terraform

In this tutorial I’ll describe all the steps to build the development version of Terraform. At the end of this process, it will generate a set of binaries for each supported platforms(Linux, Mac OS X, Windows etc..).

First we need to clone the terraform’s github offical repo:

git clone https://github.com/hashicorp/terraform.git

Move inside the cloned repo:

cd terraform

Read more of this post

AWS Infrastructure Creation with Ansible Part-4

By this point, you should have gone through the Part-1, Part-2 and Part-3 of this series. In this tutorial, we’ll create the RDS instance inside the VPC that we have created in Part-1  and Security Group created in Part-2 using Ansible.

If you have completed the previous parts of this series, then you have already clone the git repo that contains all the roles, if not then clone the git repo:

git clone https://github.com/arbabnazar/ansible-aws-roles.git
cd ansible-aws-roles

Modified the aws.yml playbook to add the desired roles:

---
- hosts: localhost
connection: local
gather_facts: no
roles:
- vpc
- ec2sg
- ec2key
- ec2instance
- elb
- rds
view raw aws-4.yml hosted with ❤ by GitHub

Note: May be, you have already noticed that we have also added the vpc, ec2sg, ec2key, ec2instance and elb roles in the playbook, it will not re-create all this except the EC2 instance(this role is not idempotent), if you have created them in the previous parts, because Ansible is idempotent. Read more of this post

Install OpenVPN server using Ansible over AWS VPC

In this tutorial, we’ll use this blog post as a base and use the below scenario in which we’ll configure the custom NAT instance to OpenVPN as well using Ansible to access the resources inside the private subnet(s).

modify-vpc

Please modify the following things for the above mentioned post:

– Open the UDP port 1194 inside the NAT instance Security Group

– Allow the desired traffic inside the desired desination server(s) Security Group for NAT instance

Read more of this post

Highly-Available WordPress Installation inside AWS VPC using Ansible

In this post,we’ll learn that how we can do Highly-Available WordPress Installation inside AWS VPC using Ansible, for this purpose we’ll be using Ubuntu 14.04 LTS EC2 Instances but you can modify it easily for RPM-based systems. If you don’t know about the Ansible, please check this link.

The purpose of Ansible AWS VPC Highly-Available WordPress(AAVHAW) is to create a fully operational AWS VPC infrastructure(subnets,routeing tables,igw etc), it will also create everything that need to be for creating EC2 and RDS instances (security key, security group, subnet group).

It will also create the Elastic Load Balancer and add the EC2 instance(s) automatically that were created using this playbook as well as creating the Route53 entry for this wordpress site and add the ELB alias to it.

Beside that, this playbook will also run the essential role(updating and patching the OS, configuring NTP,creating users etc) and deploy the wordpress on them, that will be fault tolerant and highly available.

NOTE: The part of the play, ‘webserver.yml‘, is not idempotent. Every time it run, will create a new EC2 instances.

Read more of this post

Installing the VNC server on Ubuntu using Ansible

In this post,we’ll learn that how we can install the VNC server on Ubuntu 14.04 LTS using Ansible. If you don’t know about Ansible, please check this link.

If you want manual step by step procedure to install the VNC server on Ubuntu, please refer this post.

First, download this Repository from the GitHub:

git clone https://github.com/arbabnazar/ansible-roles.git

Note: If git is not installed then you can simply download the zip file.

Read more of this post

Installing the WordPress on Ubuntu using Ansible

In this post,we’ll learn that how we can install the WordPress on Ubuntu 14.04 LTS using Ansible. If you don’t know about Ansible, please check this link.

If you want manual step by step procedure to install the WordPress on Ubuntu, please refer this post.

Note: This role depends on LEMP Stack role, it will automatically install the LEMP Stack before installing the WordPress.

First, download this Repository from the GitHub:

git clone https://github.com/arbabnazar/ansible-roles.git

Note: If git is not installed then you can simply download the zip file.

Read more of this post