Posts

Showing posts with the label How To

Install Composer on Ubuntu 21.04

Image
 In this tutorial, How to install and use PHP package manager Composer on Ubuntu 21.04 What is PHP Composer? Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) from https://getcomposer.org/ Install Composer PHP package manager The command below install Composer not just limit Ubuntu, you can use Debian and Other similar Linux systems.the latest version of Composer is not available through from APT ( Ubuntu or Debian) and Yum/DNF for Redhat-based operating systems. We will install it Github repository. Step 1: Install PHP and cURL sudo apt install -y curl unzip php php-curl Step 2: Download Composer on Ubuntu curl -sS https://getcomposer.org/installer -o composer-setup.php  Step 3: Use the PHP to install Composer sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer  Step 4: Check Composer Version composer -V The output terminal below:    How to install packages wi

Fixed Wordpress plugin install Could not create directory

Image
 In this tutorial, How to Fixed wordpress plugin install could not create directory. I'm using Nginx, PHP 7.4 and WordPress on Ubuntu 21.04.  After install and configure wordpress completed. I have update plugin and could not create directory. I installed into a wordpress directory in /var/www . Nginx does not have permissions to write to the wp-content directory. Wordpress plugin SEO Error Installing Plugin: SEO 17.0 Downloading install package from https://downloads.wordpress.org/plugin/seo.17.0.zip… Unpacking the package… Could not create directory. How to do it Fixed Step 1: Getting the connection information Create new file whoami.php into /var/www/huuphan.com/ directory. For example, the content as below root@localhost:~# cat /var/www/huuphan.com/whoami.php <?php echo(exec("whoami")); ?> root@localhost:~# Curl url or type domain in browser as below  root@localhost:~# curl https://huuphan.com/whoami.php huupv root@localhost:~# Step 2: Change owner of the word

Rclone backup all VPS to microsoft onedrive

In this tutorial, How to use Rclone backup all VPS to microsoft onedrive. It's very simple, free to backup all to Cloud with Rclone. Rclone supports a lot of Cloud services Google Drive Amazon S3 Openstack Swift / Rackspace cloud files / Memset Memstore Dropbox Google Cloud Storage Amazon Drive Microsoft OneDrive Hubic Backblaze B2 Yandex Disk SFTP The local filesystem Install Rclone on VPS Link direct download here : I use Ubuntu server on VPS. cd /root/ wget https://downloads.rclone.org/rclone-current-linux-amd64.zip unzip rclone-current-linux-amd64.zip cp rclone-v*-linux-amd64/rclone /usr/sbin/ rm -rf rclone-* Rclone command basic rclone config – Configure the connection to the cloud service. rclone copy – Copy files from server to cloud, skip if data already exists. rclone sync – Synchronize between server and cloud, only update data on cloud. rclone move – Move files from server to cloud. rclone delete – Delete the data of the folder. rclone purge – Deletes the data of the fol

Issue Let's Encrypt certificates for multiple websites Nginx

In this tutorial, How to Issue Let's Encrypt certificates for multiple websites Nginx Let's Encrypt is a free and open-source Prerequisites Ubuntu instance with a LEMP stack installed. Two valid domain name. My example, devopsroles.com and huuphan.com You have access shell login VPS. You neeed install package certbot python3-certbot-nginx on your system. Let's Encrypt Certificates and Nginx Configure Certbot Let's Encrypt certificates for the first website Let's Encrypt free SSL for website. you run command the following certbot --nginx -d huuphan.com you see the following output: root@localhost:~# certbot --nginx -d huuphan.com Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator nginx, Installer nginx Cert not yet due for renewal You have an existing certificate that has exactly the same domains or certificate name you requested and isn't close to expiry. (ref: /etc/letsencrypt/renewal/huuphan.com.conf) What would you like t

How to Install Caddy on Ubuntu

 In this tutorial, How to install Caddy on Ubuntu. The Caddy web server is an open-source web server written in Go. It is designed around simplicity and security that comes with a number of features that are useful for hosting websites. Caddy is both a flexible, efficient static file server and a powerful, scalable reverse proxy. Prerequisites A Ubuntu OS. A root user access or normal user with administrative privileges.  1. Update your system # apt update -y && apt upgrade -y 2. Install Caddy # curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add - # curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list # apt update After install Caddy on Ubuntu server. # apt install caddy 3. Open your browser and enter your server IP or domain name: http://Server-IP OR http://yourdomain.com 4. Configure Domain with Caddy Create a directory for your website files # mkdir -

How to installing Docker in Raspberry Pi 4

  In this tutorial. How to installing Docker in Raspberry Pi 4 1. Setup OS in the Raspberry Pi I used Ubuntu OS. 2. Update your system $ sudo apt update && sudo apt upgrade 3. Install basic packages $ sudo apt install net-tools git openssh-server Setting up Docker $ sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo add-apt-repository "deb [arch=arm64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" $ sudo apt-get update $ apt-cache policy docker-ce $ sudo apt-get -y install docker-ce $ sudo usermod -aG docker ${USER} Installing Docker Compose $ sudo apt install python3-pip $ sudo pip3 install docker-compose The basic command docker compose Then deploy the application: $ docker-compose up -d Find what docker-compose is running with the following command: $ docker-compose ps To remove the application $ docker-compose down  

How to enable SSH 2FA on AlmaLinux

Image
 In this tutorial, How to enable two-factor authentication (2FA) for SSH logins.  Install the Google Authenticator on AlmaLinux sudo dnf install epel-release -y sudo dnf install google-authenticator qrencode qrencode-libs -y After install completes, I will create a new secret key in ~/.ssh directory Run command as follows google-authenticator -s ~/.ssh/google_authenticator The output terminal as below [root@DevopsRoles ~]# google-authenticator -s ~/.ssh/google_authenticator Do you want authentication tokens to be time-based (y/n) y Warning: pasting the following URL into your browser exposes the OTP secret to Google:   https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/[email protected]%3Fsecret%3DDXFSMCJ42VQ7FPMS2VAJ3CIJIE%26issuer%3DDevopsRoles.com Your new secret key is: DXFSMCJ42VQ7FPMS2VAJ3CIJIE Your verification code is 222214 Your emergency scratch codes are:   36072722   12212187   31577834   31344084   92578576 Do you want me to update y

Rasberry Pi 4 can't connect to WiFi ubuntu server [fixed]

 In this tutorial, How to connect to WiFi ubuntu server on Rasberry Pi  4. Today, I buy Rasberry PI 4 new and install ubuntu 20.04 LTS. root@ubuntu:~# cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS" root@ubuntu:~#  after finish, Rasberry Pi 4 no identify ip address of wilfi. :D.  Rasberry Pi 4 can't connect to WiFi ubuntu server [fixed] The first, check network interface your system. ll -la /sys/class/net/ Create new file config for wifi " /etc/netplan/wlan.yaml" apply configure and reboot netplan apply The result, as below root@ubuntu:~# ll -la /sys/class/net/ total 0 drwxr-xr-x  2 root root 0 Jan  1  1970 ./ drwxr-xr-x 74 root root 0 Jan  1  1970 ../ lrwxrwxrwx  1 root root 0 Jan  1  1970 eth0 -> ../../devices/platform/scb/fd580000.ethernet/net/eth0/ lrwxrwxrwx  1 root root 0 Jan  1  1970 lo -> ../../devices/virtual/net/lo/ lrwxrwxrwx  1 root root 0 Apr  1  2020 wlan0 -> ../.

How to Upgrade php version on Centos 7

 In this tutorial, How to upgarde php version on Centos 7. My Server have installed php71. I will upgrade php to version php74 Type the following command to check the current version PHP. # php -v # yum list installed | grep -i php Now, Let go upgade php version to php74 If your has no remi repo, then Turn on Remi repo: # yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm Install yum-utils package # yum install yum-utils If you want to install PHP 7.1, PHP 7.2, PHP 7.3 or PHP 7.4 on CentOS 7. Just enable it as below # yum-config-manager --enable remi-php71 # yum-config-manager --enable remi-php72  # yum-config-manager --enable remi-php73 # yum-config-manager --enable remi-php74 For exmaple, I will chose php74 in this tutorial. # yum-config-manager --enable remi-php74 Update Centos 7  server. # yum update Checking version one more time # php -v You have update php version to php74 running on Centos 7 Server.

How to resolve Error: rpmdb open failed In CentOS

In this tutorial, How to resolve Error: rpmdb open failed Error In CentOS. I was testing on nginx web server in Centos 7 VM Linode . Unfortunaely, I have install new package with yum command , I got this error message: error: rpmdb: BDB0113 Thread/process 3050/139803232012096 failed: BDB1507 Thread died in Berkeley DB library error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db5 -  (-30973) error: cannot open Packages database in /var/lib/rpm CRITICAL:yum.main: Error: rpmdb open failed It seemes like YUM broke down. I have not run any yum command. Solve problem, just do the following steps.   First backup the rpm database using command as root user: # mv /var/lib/rpm/__db* /tmp Run the following command: # yum clean all # yum update Clean backup # rm -i /tmp/__db* I hope this helps you.

How to install aide centos

In this tutorial, How to install aide Centos. What does Aide mean AIDE is one of the most popular tools for monitoring the server changes in a LINUX based system.  It call as Advanced Intrusion Detection Environment. Install AIDE on Centos $ sudo yum install aide Check AIDE Version on your system $ sudo aide -v Configure AIDE $ sudo cp /etc/aide.conf /etc/aide.conf_BK Add lines not check /tmp and /proc in aide.conf file !/tmp !/proc Create the database $ sudo aide --init $ sudo mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz $ sudo cd /var/lib/aide Run the AIDE check $ sudo aide --check Set cronjob to run AIDE check $ sudo vi /etc/cron.daily/aide // The content as below: #!/bin/bash MAILTO=root LOGFILE=/var/log/aide/aide.log AIDEDIR=/var/lib/aide /usr/sbin/aide  -u > $LOGFILE cp $AIDEDIR/aide.db.new.gz $AIDEDIR/aide.db.gz x=$(grep "Looks okay" $LOGFILE | wc -l) if [ $x -eq 1 ] then     echo "A

After install setup Fedora 30

Image
In this tutorial, Things to Do After Fresh Installation Fedora 30. Let do it! TO DO 1. Update your Fedora Always keep your system updated to the latest version of packages. $ sudo dnf update 2. Change the hostname $ sudo hostnamectl status # view current hostname $ sudo hostnamectl set-hostname --static "VivoS15" # set up new hostname 3. DNF tweak edit /etc/dnf/dnf.conf file $ sudo cp /etc/dnf/dnf.conf /etc/dnf/dnf.conf_ORIG [huupv@localhost ~]$ cat /etc/dnf/dnf.conf [main] gpgcheck=1 installonly_limit=3 clean_requirements_on_remove=True fastestmirror=true deltarpm=true 4. Install RPM fusion repository $ sudo dnf update --refresh $ sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm $ sudo dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm 5. Player and codecs $ sudo dnf install youtube-dl vlc $ sudo dnf in

Leverage browser caching for Nginx

In this tutorial, How to configure Leverage browser caching for nginx. What does Leverage browser caching mean? Page load times can be significantly improved by asking visitors to save and reuse the files included in your website. Reduces page load times for repeat visitors Particularly effective on websites where users regularly re-visit the same areas of the website Benefit-cost ratio: high Access needed You should add that inside of an existing server block. For example, I will add that inside server block /etc/nginx/sites-enabled/default file. server {     listen       80;     server_name  localhost;     location / {         root   /usr/share/nginx/html;         index  index.html index.htm;     }         location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {             add_header Cache-Control "public, no-transform";             expires         7d;     } } You can test speed up site On GTmetrix

New reverse proxy tool Modlishka

You can Bypass Two-Factor Authentication and Automate Phishing Attacks by New Reverse Proxy Tool call Modlishka. A Polish cybersecurity researcher has released a tool called Modlishka designed for pen testers The tool will help the pentesters, but may also facilitating the APT Groups in phishing Modlishka Feature: Phishing tool that bypasses Gmail 2FA Support for majority of 2FA authentication schemes Support for majority of 2FA authentication schemes (by design). No website templates (just point Modlishka to the target domain - in most cases, it will be handled automatically). Full control of "cross" origin TLS traffic flow from your victims browsers (through custom new techniques). Flexible and easily configurable phishing scenarios through configuration options. Pattern based JavaScript payload injection. Striping website from all encryption and security headers (back to 90's MITM style). User credential harvesting (with context based on URL parameter passe

Vagrant up error while executing `VBoxManage`

Image
This day, I running vagrant up in my laptop then isuse. I can not start VM in vagrant. My laptop use windows 10. Error code as below: $ vagrant.exe up There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below. Command: ["showvminfo", "600a47e1-9637-4054-89c2-df3e5bf8f691"] Stderr: VBoxManage.exe: error: Code ERROR_MOD_NOT_FOUND 0x8007007E (0x8007007E) - ERROR_MOD_NOT_FOUND 0x8007007E (extended info not available) VBoxManage.exe: error: Context: "GetGuestOSType(osTypeId.raw(), osType.asOutParam())" at line 575 of file VBoxManageInfo.cpp Solve problem There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. Step 1: Right click on VirtualBox.exe and select Properties. Step 2: Click the Compatability tab. Click the button that says 'Change settings for all users'. Step 3: In the new window that pops up check '

How to install 3proxy on centos 7

Image
In this tutorial, How to install 3proxy on centos 7 ? How to configure 3proxy for multiple 3G USB modems. Pre-install The package for Centos 7 $ sudo yum update $ sudo yum -y install wget nano epel-release net-tools $ sudo yum -y groupinstall "Development Tools" $ sudo systemctl stop firewalld && systemctl disable firewalld # For example, My LAB turn off firewalld. Installing 3proxy on Centos 7 $ wget https://github.com/z3APA3A/3proxy/archive/0.8.12.tar.gz $ tar zxfv 3proxy.gz $ cd 3proxy-0.8.12/ $ sudo make -f Makefile.Linux $ sudo mkdir /usr/local/3proxy $ sudo cp src/3proxy /usr/local/3proxy/ $ sudo chmod +x /usr/local/3proxy/3proxy Creating the main configurator 3proxy.cfg file. $ sudo nano /usr/local/3proxy/3proxy.cfg And paste the following content: #!/bin/bash IPv4=`ip addr list enp0s3 | grep " inet " | head -n 1 | cut -d " " -f 6 | cut -d / -f 1` IP=`ip addr list ppp0 | grep " inet " | head -n 1 | cut -d " &quo

How to install wvdial on ubuntu 18.04

In this tutorial, How to install wvdial on ubuntu 18.04. You want to install wvdial for USB 3G/4G Modem. Link download wvdial package for ubuntu 18.04 here . Pre install for ubuntu 18.04 $ sudo apt-get install build-essential Install wvdial on ubuntu 18.04 $ sudo dpkg -i wvdial_1.61-4.1build1_amd64.deb The during install wvdial some error as below: root@serverubuntu:~# dpkg -i wvdial_1.61-4.1build1_amd64.deb Selecting previously unselected package wvdial. (Reading database ... 107834 files and directories currently installed.) Preparing to unpack wvdial_1.61-4.1build1_amd64.deb ... Unpacking wvdial (1.61-4.1build1) ... dpkg: dependency problems prevent configuration of wvdial:  wvdial depends on libuniconf4.6; however:   Package libuniconf4.6 is not installed.  wvdial depends on libwvstreams4.6-base; however:   Package libwvstreams4.6-base is not installed.  wvdial depends on libwvstreams4.6-extras; however:   Package libwvstreams4.6-extras is not installed. dpkg: error proc