A Step-by-Step Guide Vagrant install Redis server

Introduction

In this tutorial, How to use Vagrant install Redis server. Vagrant, a powerful open-source tool, allows developers to create and manage lightweight, reproducible, and portable virtual machines effortlessly.

My Environment for Vagrant install Redis server

  • Host OS: Windows 11
  • Vagrant version: 2.2.18
  • Vagrant provider: VirtualBox
  • Boxes Vagrant: rockylinux/8
  • Terminal/PowerShell
  • Installed VirtualBox

The vagrant directory and files will look like as below:

C:\MYDATA\VAGRANT_VMS\PROJECTS\VAGRANT\ROCKY-REDIS
│   Vagrantfile
│
├───conf
│       redis.conf
│
└───shell
        init-redis.sh

I created an “init-redis.sh” script to install Redis Server on Rocky Linux. I use the provisioning shell of Vagrant to deploy Redis Server on Rocky Linux.

The content script is as below:

#!/bin/bash

# Install Redis
sudo dnf install -y git unzip net-tools
sudo dnf module install redis -y

sudo sysctl vm.overcommit_memory=1
echo never > sudo  /sys/kernel/mm/transparent_hugepage/enabled

#Configure Redis
sudo cp /etc/redis.conf /etc/redis.conf.orig
sudo cp /vagrant/conf/redis.conf /etc/redis.conf

sudo systemctl start redis
sudo systemctl enable redis
sudo systemctl status redis

For example, the File “redis.conf” configures Redis Server as below:

bind 0.0.0.0
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile /var/log/redis/redis.log
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/lib/redis
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
replica-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
requirepass devosroles.com

Create a Virtual Machine

I will navigate to my working directory. For example, the “Rocky-Redis” folder and create initialized Vagrantfile vagrant as the command below.

cd Rocky-Redis
vagrant init rockylinux/8

Configure the Virtual Machine

Edit the Vagrantfile and paste the content below

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

  config.vm.box = "rockylinux/8"
  config.ssh.insert_key = false  

  config.vbguest.auto_update = false
  
  config.vm.define "redisserver" do |redisserver|
    redisserver.vm.hostname = "devopsroles.com"
    redisserver.vm.network "private_network", ip: "192.168.4.4"
    redisserver.vm.network "forwarded_port", guest: 6379, host: 6379
    redisserver.vm.provision "shell", 
     path: "C:\\MyData\\Vagrant_VMS\\Projects\\Vagrant\\Rocky-Redis\\shell\\init-redis.sh"

  end

end

Deploy Redis Server on Rocky Linux

Use the command below to create and configures guest machines according to your Vagrantfile.

vagrant up

Finally, we will connect to the Redis server.

vagrant ssh redisserver

The output terminal as below

Conclusion

You’ve successfully installed the Redis server on a virtual machine using Vagrant. With this setup, you can now develop and test your Redis-dependent applications in an isolated and portable environment.

Vagrant’s ease of use and versatility make it an invaluable tool for any developer’s toolkit. I hope will this your helpful. Thank you for reading the DevopsRoles page!

Vagrant LEMP stack: A Comprehensive Guide from Basic to Advanced

Introduction

In this tutorial, I wrote deploy Vagrant LEMP stack. I will install and configure the LEMP stack for this web application.

Vagrant is a powerful tool for managing virtual development environments, and the LEMP stack (Linux, Nginx, MySQL, PHP) is a popular choice for web developers due to its performance and flexibility. Combining Vagrant with a LEMP stack allows developers to create a consistent and reproducible environment, making development and collaboration more efficient.

What does lemp stand for?

Linux operating system, and Nginx (pronounced engine-x, hence the E in the acronym) webserver. MySQL database and dynamic content processed by PHP.

My Environment for Vagrant LEMP stack

  • Host OS: Window 11
  • Vagrant version: 2.2.18
  • Vagrant provider: VirtualBox
  • Boxes Vagrant: rockylinux/8
  • Terminal/PowerShell

Vagrant directory and files will look like as below:

C:\MYDATA\VAGRANT_VMS\PROJECTS\VAGRANT\ROCKY-LEMP
│   Vagrantfile
│
├───Files

│       index.html
│       info.php
│
└───shell

        web-lemp-rocky.sh

Files Folder contains test Nginx and PHP with index.html and info.php files.

The content index.html and info.php files

# index.html file

<html>
    <h2>DevopsRoles.com</h2>
</html>

# info.php file

<?php
phpinfo();
?>

I created a web-lemp-rocky.sh script to install Nginx, MySQL, and PHP on Rocky Linux. I use the provisioning shell of Vagrant to deploy LEMP on Rocky Linux.

The content script is as below:

#!/bin/bash


#Tools
sudo dnf install -y git unzip net-tools

#Apache
sudo dnf install -y nginx

#chkconfig --add nginx
sudo systemctl enable nginx
sudo systemctl stop nginx

sudo systemctl start nginx

#PHP
sudo dnf install php php-fpm php-gd php-mysqlnd php-cli php-opcache
sudo systemctl enable php-fpm
sudo systemctl start php-fpm

#MySQL
sudo dnf install -y mysql mysql-server mysql-devel
sudo systemctl enable mysqld.service
sudo systemctl start mysqld

mysql -u root -e "SHOW DATABASES";

# content
# sudo rm -rf /var/www/html/*
sudo cp -rf /vagrant/Files/{index.html,info.php} /usr/share/nginx/html/
# cd /vagrant
#sudo -u vagrant wget -q https://raw.git.....

sudo systemctl restart nginx

Create a Virtual Machine

Navigate to my working directory

cd Rocky-LEMP
vagrant init rockylinux/8

Configure the Virtual Machine

Edit the Vagrantfile and paste the content below

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

  config.vm.box = "rockylinux/8"
  config.ssh.insert_key = false  

  config.vbguest.auto_update = false
  
  config.vm.define "webserver" do |webserver|
    webserver.vm.hostname = "devopsroles.com"
    webserver.vm.network "private_network", ip: "192.168.4.4"
    webserver.vm.network "forwarded_port", guest: 80, host: 8888
    webserver.vm.provision "shell", 
     path: "C:\\MyData\\Vagrant_VMS\\Projects\\Vagrant\\Rocky-LEMP\\shell\\web-lemp-rocky.sh"

  end

end

Deploy LEMP on Rocky Linux

vagrant up

To connect to Web Server.

vagrant ssh webserver

The output terminal is below

Opens a browser that can access your Server’s IP address.

Testing PHP

FAQs

What is Vagrant used for?

Vagrant is used for creating and managing virtual development environments, allowing developers to work in a consistent and isolated environment.

Why choose the LEMP stack over LAMP?

The LEMP stack uses Nginx instead of Apache, offering better performance and scalability for handling high-traffic websites.

How do I access the Vagrant VM’s web server?

You can access it using the IP address assigned to the VM or using a private network setup.

Can I use a different operating system for the Vagrant box?

Yes, Vagrant supports various operating systems, and you can specify a different box in the Vagrantfile.

Conclusion

Setting up a Vagrant LEMP stack is a powerful way to streamline your development process. By following this guide, you can create a consistent, isolated, and easily reproducible environment for your web development projects. Whether you’re a beginner or looking to implement advanced configurations, Vagrant provides the flexibility and control needed to optimize your workflow.

You have to use the Vagrant LEMP stack on Rocky Linux. I hope will this your helpful. Thank you for reading the DevopsRoles page!

Run Multiple Ansible Versions using Python 3 Virtual Environments

#Introduction

In this tutorial, How to Run Multiple Ansible Versions using Python 3 Virtual Environments. You can install multiple versions for Ansible

The benefits of using a virtual environment run Multiple Ansible Versions

  • Each project its isolated environment and modules
  • The base system is not affected
  • Does not require root access as virtual environments

Install Python 3

CentOS 7

sudo yum -y install epel-release
sudo yum -y install python36 python36-pip

Ubuntu

Check the python version

python3 --version

If python is not installed by default, you can install it

sudo apt install python3.9 python3.9-venv

check the python version.

python3 -V

The output terminal is as below:

vagrant@devopsroles:~$ python3 -V
Python 3.9.5

Create Virtual Environments

First, we will need to create a folder that we’ll use to store the virtual environments. You do not create inside your project folder.

mkdir ~/python-environment

For example, I create two environments for different versions of Ansible using venv modules

cd ~/python-environment
python3.9 -m venv ansible2.7.0
python3.9 -m venv ansible2.8.0

The output terminal as below

Activate an environment ansible version 2.7.0

source ansible2.7.0/bin/activate

Use pip install ansible 2.7.0

pip install --upgrade pip setuptools
pip install ansible==2.7.0
ansible --version

The output terminal as below

List of Python packages that have been installed in this environment

pip list

deactivate the environment

deactivate

The output terminal as below

Set up the second environment for ansible version 2.8.0

cd ~/python-environment
source ansible2.8.0/bin/activate
pip install --upgrade pip setuptools
pip install ansible==2.8.0
ansible --version
pip list
deactivate

You have the environments set up and use pip to install any packages without risk the base system packages.

Conclusion

You have Run Multiple Ansible Versions using Python 3 Virtual Environments. I hope will this your helpful. Thank you for reading the DevopsRoles page!

Docker deploy a Bitwarden server

#Introduction

In this tutorial, How to deploy an in-house password manager server.

Bitwarden is an integrated open source password management solution for individuals, teams, and business organizations.

Install Docker on Ubuntu

sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce docker-compose

Obtain Bitwarden’s Installation key and ID

you via Bitwarden page get key and ID as the picture below

The display picture as below as below

Create the Bitwarden user

sudo mkdir /opt/bituser
sudo adduser bituser
sudo chmod -R 700 /opt/bituser
sudo chown -R bituser:bituser /opt/bituser
sudo usermod -aG docker bituser

Change to the Bitwarden user with the command below

su bituser
cd
pwd

Download the script and deploy Bitwarden

Download the script with the command below

curl -Lso bitwarden.sh https://go.btwrdn.co/bw-sh && chmod 700 bitwarden.sh

Bitwarden use on port 80, If you start apache/Nginx then stop it.

sudo systemctl stop apache2
# Redhat
sudo systemctl stop httpd
# Stop Nginx
sudo systemctl stop nginx

Installer Bitwarden

./bitwarden.sh install

The output terminal as below

Finally, we need to configure the SMTP server that Bitwarden will use it.

After installing Bitwarden, open the configuration file with:

nano /home/bituser/bwdata/env/global.override.env

You will replace every REPLACE with your SMTP Server.

globalSettings__mail__smtp__host=REPLACE
globalSettings__mail__smtp__port=REPLACE
globalSettings__mail__smtp__ssl=REPLACE
globalSettings__mail__smtp__username=REPLACE
globalSettings__mail__smtp__password=REPLACE
adminSettings__admins= ADMIN_EMAIL

Start the Bitwarden server.

./bitwarden.sh start

Access your Bitwarden server

Open a web browser and point it to https://SERVER

The display picture as below as below

Note: Create a new account to login into Bitwarden

Conclusion

You have to deploy a Bitwarden server. I hope will this your helpful. Thank you for reading the DevopsRoles page!

Vagrant multiple servers

Introduction

In this tutorial, How to deploy multiple servers using Vagrant. I will deploy LAMP multiple servers. I create more VMs, each VM can have its own and different configuration.

My Environment

  • Host OS: Window 11
  • Vagrant version: 2.2.18
  • Vagrant provider: VirtualBox
  • Boxes Vagrant: rockylinux/8
  • Terminal/PowerShell

LAMP server architecture

Vagrant directory and files will look like as below:

C:\MYDATA\VAGRANT_VMS\PROJECTS\VAGRANT\VM-MULTI-SERVER
│   Vagrantfile

│
└───shell
        common-rocky.sh
        database-rocky.sh
        web-rocky.sh

I created common-rocky.sh script to deploy the common packages as below

#!/bin/bash

#Update OS
# sudo yum update -y --exclude=kernel

#Tools
sudo yum install -y git unzip nc telnet

web-rocky.sh script to install the package Apache, PHP as below

#!/bin/bash

#Apache
sudo dnf install -y httpd httpd-devel httpd-tools

#chkconfig --add httpd
sudo systemctl enable httpd.service
sudo systemctl stop httpd

sudo systemctl start httpd

#PHP
sudo dnf install -y php php-cli php-gd php-curl php-zip php-mbstring php-opcache php-intl php-mysqlnd

database-rocky.sh script to install MySQL server as below

#!/bin/bash

#MySQL
sudo yum install -y mysql mysql-server mysql-devel
sudo systemctl enable mysqld.service
sudo systemctl start mysqld

mysql -u root -e "SHOW DATABASES";

Create a Virtual Machine

Navigate to my working directory

cd Rocky-LAMP
vagrant init rockylinux/8

Configure the Virtual Machine

Edit the Vagrantfile and paste the content below

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

  config.vm.box = "rockylinux/8"
  config.ssh.insert_key = false  
  config.vm.provision "shell", 
   path: "C:\\MyData\\Vagrant_VMS\\Projects\\Vagrant\\VM-multi-server\\shell\\common-rocky.sh"

  config.vbguest.auto_update = false
  
  config.vm.define "webserver" do |webserver|
    webserver.vm.hostname = "devopsroles.com"
    webserver.vm.network "private_network", ip: "192.168.4.4"
    webserver.vm.network "forwarded_port", guest: 80, host: 8888
    webserver.vm.provision "shell", 
     path: "C:\\MyData\\Vagrant_VMS\\Projects\\Vagrant\\VM-multi-server\\shell\\web-rocky.sh"

  end

  config.vm.define "databases" do |databases|
    databases.vm.hostname = "database-server"
    databases.vm.network "private_network", ip: "192.168.4.5"
    databases.vm.provision "shell", 
     path: "C:\\MyData\\Vagrant_VMS\\Projects\\Vagrant\\VM-multi-server\\shell\\database-rocky.sh"

  end

end

Deploy LAMP on Rocky Linux

vagrant up

To connect to Web Server.

vagrant ssh webserver

To connect to the database server.

vagrant ssh databases

Opens a browser that can access your Server’s IP address

Conclusion

You have to use Vagrant to install LAMP for multiple servers. I hope will this your helpful. Thank you for reading the DevopsRoles page!

Deploy LAMP on rocky Linux using Vagrant

#Introduction

In this tutorial, How to deploy LAMP on Rocky Linux using Vagrant. LAMP is Linux Operating System, Apache Web Server, MySQL Database, and PHP Programming Language.

Development Environments Made Easy Quote by www.vagrantup.com

My Environment

  • Host OS: Window 11 or Ubuntu / Centos or Rocky server.
  • Vagrant version: 2.2.18
  • Vagrant provider: VirtualBox
  • Boxes Vagrant: rockylinux/8
  • Terminal/PowerShell

Deploy LAMP on rocky Linux using Vagrant directory and files will look like as below:

C:\MYDATA\VAGRANT_VMS\PROJECTS\VAGRANT\ROCKY-LAMP
|   Vagrantfile
|
+---Files
|       gitconfig
|       index.html
|       info.php
|
\---Scripts
        lamp-rocky.sh

Create a Virtual Machine

Navigate to my working directory and create an initial Vagrantfile if one does not already exist.

cd Rocky-LAMP
vagrant init rockylinux/8

Configure the Virtual Machine

You need to edit the Vagrantfile and paste the content as below

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

  config.vm.box = "rockylinux/8"
  config.vm.hostname = "devopsroles.com"
  config.ssh.insert_key = false
  config.vm.network "private_network", ip: "192.168.4.4"
  config.vm.network "forwarded_port", guest: 80, host: 8888
  config.vbguest.auto_update = false
  # Install LAMP on Rocky server
  config.vm.provision "shell", 
  path: "C:\\MyData\\Vagrant_VMS\\Projects\\Vagrant\\Rocky-LAMP\\Scripts\\lamp-rocky.sh"
  # Test HTML
  #config.vm.provision "file", 
  # source: "C:\\MyData\\Vagrant_VMS\\Projects\\Vagrant\\Rocky-LAMP\\Files\\index.html",
  # destination: "/var/www/html/index.html"
  #Test PHP
  #config.vm.provision "file", 
  # source: "C:\\MyData\\Vagrant_VMS\\Projects\\Vagrant\\Rocky-LAMP\\Files\\info.php",
  # destination: "/var/www/html/info.php"
end

I use provision shell to install Apache, MySQL, and PHP on Rocky Linux. The script update OS, install the packages: Apache PHP and MySQL.

The content “lamp-rocky.sh” script is as below:

#!/bin/bash

#Update OS
sudo yum update -y --exclude=kernel

#Tools
sudo yum install -y git unzip

#Apache
sudo dnf install -y httpd httpd-devel httpd-tools

#chkconfig --add httpd
sudo systemctl enable httpd.service
sudo systemctl stop httpd

sudo systemctl start httpd

#PHP
sudo dnf install -y php php-cli php-gd php-curl php-zip php-mbstring php-opcache php-intl php-mysqlnd

#MySQL
sudo yum install -y mysql mysql-server mysql-devel
sudo systemctl enable mysqld.service
sudo systemctl start mysqld

mysql -u root -e "SHOW DATABASES";

# content
sudo rm -rf /var/www/html/*
sudo cp -rf /vagrant/Files/{index.html,info.php} /var/www/html/
# cd /vagrant
#sudo -u vagrant wget -q https://raw.git.....

sudo systemctl restart httpd

Deploy LAMP on Rocky Linux

We use the “vagrant up” command line. This command creates and configures guest machines according to your Vagrantfile

vagrant up

How to connect to the virtual machine.

vagrant ssh

The output terminal as below

C:\MyData\Vagrant_VMS\Projects\Vagrant\Rocky-LAMP>vagrant ssh
[vagrant@devopsroles ~]$ cat /etc/redhat-release
Rocky Linux release 8.5 (Green Obsidian)
[vagrant@devopsroles ~]$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:fc:e9:96 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute eth0
       valid_lft 85565sec preferred_lft 85565sec
    inet6 fe80::a00:27ff:fefc:e996/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:cf:7f:96 brd ff:ff:ff:ff:ff:ff
    inet 192.168.4.4/24 brd 192.168.4.255 scope global noprefixroute eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fecf:7f96/64 scope link
       valid_lft forever preferred_lft forever

You need to open a browser that can access your Server’s IP address.

The resulting output picture as below:

A page displaying the PHP version among other parameters such as details of PHP extensions enabled will be displayed below

Conclusion

You have to deploy LAMP on rocky Linux using Vagrant. I hope will this your helpful. Thank you for reading the DevopsRoles page!

vagrant ssh Permission denied fixed: A Comprehensive Guide

Introduction

In this tutorial, How to fix vagrant SSH permission denied. I use Host OS Windows 11 and Vagrant. I have to deploy a VM using Vagrant. Finish, login ssh to guest OS.

vagrant up command error as below:

vagrant@127.0.0.1: Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

Understanding the Error

What is the “vagrant ssh Permission denied” Error?

The “vagrant SSH Permission denied” error occurs when the Vagrant fails to establish an SSH connection to the virtual machine. This can be caused by various issues such as incorrect SSH keys, misconfigured Vagrantfiles, or permission issues.

Common Causes

  1. Incorrect SSH Key Permissions: The SSH key file might not have the correct permissions.
  2. Missing or Incorrect SSH Keys: The SSH key might be missing or not properly configured.
  3. Vagrantfile Misconfiguration: The Vagrantfile may have incorrect settings.
  4. User Permissions: The user running Vagrant may not have the necessary permissions.

My Environment

  • Host OS: Windows 11 or Linux/Ubuntu/Redhat
  • Vagrant version: 2.2.18
  • Vagrant provider: VirtualBox
  • Boxes Vagrant: rockylinux/8

For example, My Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

  config.vm.box = "rockylinux/8"
  config.vm.network "forwarded_port", guest: 80, host: 8888
  config.vbguest.auto_update = false
end

Deploy a Virtual Machine

vagrant up

The output terminal is as follows:

How do fix vagrant SSH permission denied

I add configure “config.ssh.insert_key = false” into the Vagrantfile file

After changing my Vagrantfile as the content below

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

  config.vm.box = "rockylinux/8"
  config.ssh.insert_key = false
  config.vm.network "forwarded_port", guest: 80, host: 8888
  config.vbguest.auto_update = false
end

The result

Frequently Asked Questions

Why am I getting a “vagrant SSH permission denied” error?

This error occurs when Vagrant fails to establish an SSH connection to the virtual machine, often due to incorrect SSH key permissions, missing keys, misconfigured Vagrantfiles, or user permission issues.

How do I fix SSH key permission issues in Vagrant?

You can fix SSH key permission issues by setting the correct permissions with the command chmod 600 ~/.ssh/id_rsa.

Can I regenerate the SSH key for Vagrant?

Yes, you can regenerate the SSH key for Vagrant by destroying the existing machine, removing the old key, and reinitializing Vagrant.

How do I manually add an SSH key to the SSH agent?

Start the SSH agent eval "$(ssh-agent -s)" and add your SSH key with ssh-add ~/.ssh/id_rsa.

Should I update Vagrant and its plugins?

Yes, updating Vagrant and its plugins can resolve many issues, including SSH connection problems. Use vagrant plugin update and vagrant box update to update them.

Conclusion

Encountering the “vagrant SSH Permission denied” error can be frustrating, but with the steps outlined in this guide, you should be able to resolve it efficiently. From checking SSH key permissions to updating Vagrant, these solutions cover both basic and advanced troubleshooting methods. Ensuring smooth operation of your Vagrant environments is crucial for a seamless development workflow. Thank you for reading the DevopsRoles page!

Install LAMP Stack on Rocky Linux

Introduction

In this tutorial, How to Install LAMP Stack on Rocky Linux. A LAMP stack, which stands for Linux, Apache, MySQL (or MariaDB), and PHP, is a popular software bundle that provides the necessary components for hosting dynamic websites and web applications. In this tutorial, we’ll walk you through the steps to set up a LAMP stack on a Rocky Linux server.

Prerequisites

Before we begin, ensure that you have:

  • A running Rocky Linux instance
  • Root or sudo privileges
  • A stable internet connection

How to install LAMP Stack on Rocky Linux

Install Apache on Rocky Linux

Apache HTTP Server is one of the most widely used web servers in the world. To install it, run the following command:

dnf install -y httpd httpd-devel httpd-tools

Enable Apache start at boot time

systemctl enable httpd

start the Apache HTTPd daemon

systemctl start httpd

To check Apache running on Rocky Linux

systemctl status httpd

The output terminal is below

Opens a browser that can access your Server’s IP address

http://Your-IP-address
OR
http://domain.com

Install MariaDB on Rocky Linux

Next, you’ll need a database server. You can choose between MariaDB and MySQL. In this example, we’ll use MariaDB. Install it with the following command:

dnf install mariadb-server mariadb

The output terminal as below

Enable MariaDB to start at boot time

systemctl enable --now mariadb

Start the MariaDB daemon

systemctl start mariadb

To check MariaDB running on Rocky Linux

systemctl status mariadb

Additional steps to harden the database server. Run the MariaDB security script to secure your installation:

mysql_secure_installation
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

Follow the on-screen prompts to set a root password and improve the security of your database server.

Install PHP on Rocky Linux

The default PHP stream is PHP 7.2. PHP is a server-side scripting language commonly used in web development. Install PHP and the PHP MySQL extension with the following command:

To install the latest module Stream. We will reset the PHP streams.

dnf module reset php

Install PHP 7.4

dnf module install php:7.4

The output terminal is below

Install additional PHP extensions

dnf install php-cli php-gd php-curl php-zip php-mbstring php-opcache php-intl php-mysqlnd

Confirm the version of PHP installed

php -v

The output terminal is below

Test Your Install LAMP Stack

To verify that your LAMP stack is installed and running correctly, create a test PHP file in the Apache web root directory. We’ll use info.php as an example:

We create a test PHP file in the /var/www/html path.

vi /var/www/html/info.php

The content info.php is below

<?php
phpinfo();
?>

Save the changes and restart the webserver.

systemctl restart httpd

Open back browser

http://server-ip/info.php

The output is below

Remove file test PHP

rm -f /var/www/html/info.php

Conclusion

Congratulations! You’ve successfully install LAMP stack on your Rocky Linux server. You now have a powerful platform for hosting websites and web applications. Remember to secure your server, keep your software up to date, and regularly back up your data to ensure a stable and reliable web hosting environment. I hope will this your helpful. Thank you for reading the DevopsRoles page!

This comprehensive guide should equip you with the knowledge to manage and expand your LAMP stack setup. For any further customization or troubleshooting, refer to the official documentation and community forums. Happy coding!

Refer to:

Vagrant: Unknown configuration section vbguest

#Introduction

In this tutorial, How to fix the Unknown configuration section vbguest on Vagrant. Now, let’s fix Vagrant: Unknown configuration section vbguest.

  • Environment: CentOS 6x.
  • Vagrant version 2.2.18

My Vagrantfile

Vagrant.configure("2") do |config|
-----
config.vbguest.auto_update = false
-----

Error: Unknown configuration section vbguest

The reason is because of the missing vagrant.vbguest plugin.

Check plugin for Vagrant

C:\Users\HuuPV>vagrant plugin list
not found

1.If not, install “vagrant-vbguest

C:\MyData\Vagrant_VMS\Projects\Vagrant\Centos6.5-LAMP>vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Fetching micromachine-3.0.0.gem
Fetching vagrant-vbguest-0.30.0.gem
Installed the plugin 'vagrant-vbguest (0.30.0)'!

2. If exist, uninstall and reinstall “vagrant-vbguest

vagrant plugin uninstall vagrant-vbguest
vagrant plugin install vagrant-vbguest

Conclusion

You have fixed Vagrant: Unknown configuration section vbguest. I hope will this your helpful. Thank you for reading the DevopsRoles page!

Git Cheat Sheet

Introduction

How to use the git command every day. Git Cheat Sheet I use it every day. Git has become an essential tool for developers, allowing them to efficiently manage version control and collaborate on projects.

this guide will provide you with a comprehensive overview of Git’s essential commands and workflow. Let’s dive in!

What does Git mean?

Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Quote from Wikipedia.

Git Cheat Sheet Example

Check my git configure

git config -l

Configuration

Before you start using Git, it’s crucial to set up your configuration. You can configure your username and email globally using the git config command. For example Setup my Git username and Email Id

git config --global user.name "HuuPV"
git config --global user.email "HuuPV@devopsroles.com"

Username and EmailID assigned to commit from local computer.

Creating and Cloning Repositories

git init

Add a file to the staging area in Git

git add file_name

Add all files in your project to the staging area in Git

git add .

Commit changes for the files in a local repo.

git commit
git commit -m "first commit"

Shows the commit history for the current repository

git log

Show if a file is in the staging area, but not committed

git status

Remove tracked files from the current working tree

git rm filename

Rename files

git mv oldfile newfile

Branches

Branches are a powerful feature in Git, allowing you to work on different versions of your code simultaneously.

Create a new branch

git branch branch_name

Switch to a newly created branch

git checkout branch_name

Create a new branch and switch it immediately

git checkout -b branch_name

List branches

git branch

Merge and Remote Repositories

Merge two branches

git merge branch_name

Add a remote repository to your local repository

git add remote https://repo_url_here

Git clone

git clone

download updates from a remote repository.

git pull

After committing your changes, the next you send changes to the remote server.

git push
#or force push
git push -f

History and Logs

Git provides extensive tools to explore commit history. The git log the command shows the commit history

git log

The display presents a more compact view

git log --oneline

If you prefer a graphical representation, git log --graph creates a commit history graph.

git log --graph

To view the details of a specific commit

git show <commit>

Conclusion

Git is a powerful version control system that enables efficient collaboration and project management. This guide has provided an overview of essential Git commands and workflows, giving you a solid foundation to start using Git effectively

You have used Git Cheat Sheet every day. I hope will this your helpful. Thank you for reading the DevopsRoles page!

Devops Tutorial

Exit mobile version