Wednesday, December 27, 2023

How to Archiving Amazon S3 Data to Amazon Glacier

 How to Archiving Amazon S3 Data to Amazon Glacier

As you know in AWS S3 we have different tier of storage. Based on our requirement we need to use the correct one to save cost and to meet the purpose. One of such requirement is to move the old backup files from S3 to amazon Glacier.


In this video you will learn how to archiving amazon s3 data to amazon glacier.






Tuesday, September 26, 2023

How to install OCI CLI in CentOS 8 Stream

 How to install OCI CLI in CentOS 8 Stream

The steps mentioned in the internet is not working for me. So this is the working commands.

# yum install python38 -y

# ll /usr/bin/pip3.8

# ll /usr/bin/pip-3.8

# pip3.8 install oci-cli

# oci --version

Monday, September 18, 2023

How to redirect 404 error to the home page

 How to redirect 404 error to the home page

Following steps helps to redirect all 404 error pages to the home page. Assume you already installed httpd in this server.

  • Make sure you enabled "rewrite_modile" (httpd - M | grep rewrite)
  • vi /etc/httpd/conf/httpd.conf (enable AllowOverride from "None" to "All"). Based on your configuration path.
  • vi /var/www/html/.htaccess (ErrorDocument 404 https://example.com)
  • systemctl restart httpd
  • Test it

How to install letsencrypt on Amazon linux 2023

 How to install letsencrypt on Amazon linux 2023

In Amazon linux 2023, EPEL is not available. All the documentations avaialble in internet is about EPEL and then install certbot. But here we need to use a different approach.

  • Login to the server
  • dnf install python3 augeas-libs
  • dnf remove certbot
  • python3 -m venv /opt/certbot/
  • /opt/certbot/bin/pip install --upgrade pip
  • /opt/certbot/bin/pip install certbot certbot-apache
  • ln -s /opt/certbot/bin/certbot /usr/bin/certbot
  • certbot --apache
This works perfectly for me. 🙋🙋
Here is the video tutorial. Have a look and install.


Wednesday, September 6, 2023

Single command to checkout all branches in git

 Single command to checkout all branches in git


[yourserver #] for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do; git branch --track ${branch#remotes/origin/} $branch; done;


This is useful when we do git migrations.

Monday, July 24, 2023

The GPG keys listed for the "MySQL 8.0 Community Server" repository are already installed but they are not correct for this package. Check that the correct key URLs are configured for this repository.

 OS : CentOS 7

Error while installing Mysql

The GPG keys listed for the "MySQL 8.0 Community Server" repository are already installed but they are not correct for this package.

Check that the correct key URLs are configured for this repository.


Fix:


Import new key from rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022


Yum update

yum install mysql-server

Thursday, June 15, 2023

Access denied for user 'user'@'hostname' (using password: YES) in mysql8

 Error : Access denied for user 'user'@'hostname' (using password: YES) in mysql8

Mysql version is Mysql8

OS is Ubuntu 22

I am sure that i can connect from my both apps servers to the DB from the command shell.

The issue is the mysql user password. In my password, i had some special characters. When we input this password in command prompt, in bash shell it will work. But its not working from nodejs code (.env file)

Solution :

I change the password without a special character and the issue got fixed.

Thursday, January 26, 2023

unable to find /root/.my.cnf. Exception message: (1698, \"Access denied for user 'root'@'localhost

 While running Ansible 2.14.1, i am getting the error

"unable to find /root/.my.cnf. Exception message: (1698, \"Access denied for user 'root'@'localhost

Solution to fix is :

You need to login to the server and find the mysqld.sock file. In my Ubuntu22 machine its /var/run/mysqld/mysqld.sock

I need to update this in my playbook as

- name: Create Application database
mysql_db: name=employee_db state=present login_unix_socket=/var/run/mysqld/mysqld.sock

- name: Create Database User
mysql_user:
name : db_user
password: Passw0rd
priv: '*.*:ALL'
login_unix_socket: /var/run/mysqld/mysqld.sock
state: present

Monday, January 2, 2023

ansible ssh key path in different location - Part 2

 Normally we will add the private key of the server in our .ssh/authorized keys, right?

But i want to keep the ssh key in a different location.

I created a folder called "centos" and i am planning to keep all the ansible files related to this project under this folder.

/Users/shivinvijai/Desktop/Learnings/Ansible/centos

In this folder, I fist created an inventory file.

shivinvijai@Shivins-MacBook-Pro centos % cat inventory 

[myservers]

150.61.189.96 ansible_user=opc ansible_ssh_private_key_file=/Users/shivinvijai/Desktop/Learnings/Ansilbe/ssh-key-2023-01-01.key

shivinvijai@Shivins-MacBook-Pro centos %

I specify my username and path to the ssh key file.

Now, I going to do a test, here i am using my own inventory file so the command will be this

shivinvijai@Shivins-MacBook-Pro centos % ansible -i inventory  -m ping myservers

150.61.189.96 | SUCCESS => {

    "ansible_facts": {

        "discovered_interpreter_python": "/usr/libexec/platform-python"

    },

    "changed": false,

    "ping": "pong"

}



Sunday, January 1, 2023

ansible host file location mac

 This is my first experience in MAC as an ansible control node. The FIX is listed in this link

https://www.linuxblackmagic.com/2023/01/setting-up-my-mac-as-control-node-for.html

This will fix your issue, for me its working fine.

Setting up my MAC as a Control node for my Ansible study - Part 1

 Here is my requirement, I am using my MAC so i need to develop Ansible playbooks in my MAC book.

I used PIP to install ansible in my mac book. After installation i am not able to do any ansible commands and I fixed the issue using this link (https://www.linuxblackmagic.com/2023/01/after-install-ansible-using-pip-in-mac.html)

After this, when you try to add hosts or ansible.cfg file, you may not find this in your mac.

I checked $HOME/.ansible folder and i can't find it.

I downloaded a sample configuration of ansible.cfg to the $HOME/.ansible folder

Then i created a hosts file which is defined in the inventory section of the ansible.cfg file.

localhost              ansible_connection=local

Then I tried a test using this command.

 ansible -i $HOME/.ansible/hosts -m ping all

localhost | SUCCESS => {

    "ansible_facts": {

        "discovered_interpreter_python": "/opt/homebrew/bin/python3.11"

    },

    "changed": false,

    "ping": "pong"

} 

After install ansible using pip in mac, I can't able to issue any ansible commands

 I installed ansible in my Mac using PIP. After installation i am not able to execute any ansible commands.

Fix :

Only for current session, you can export the path

export PATH="/Users/<username>/Library/Python/3.10/bin:$PATH"

For making it permeant, you need to open the file

vi ~/.zshrc (If not present, feel free to create it)

export PATH="/Users/<username>/Library/Python/3.10/bin:$PATH:

Source it,

source ~/.zshrc

After this, i could able to use ansible commands in my Mac