Posts

Showing posts with the label How To

How to create a local yum repository for Centos/Redhat/Fedora

Image
In this tutorial, How to create a local yum repository for Centos / Redhat / Fedora . Step 1: mount your ISO file Create folder path /mnt/dvd [huupv@huupv huuphan.com]$ sudo mkdir -p /mnt/dvd If you used a physical DVD [huupv@huupv huuphan.com]$ sudo umount /dev/sr0 [huupv@huupv huuphan.com]$ sudo mount -t iso9660 -o ro /dev/sr0 /mnt/dvd If you used an IOS file [huupv@huupv huuphan.com]$ sudo mount -t iso9660 -o loop,ro /opt/CentOS-7-x86_64-Minimal-1511.iso /mnt/dvd Step 2: Create the repository I'll use vi editor. [huupv@huupv huuphan.com]$  vi /etc/yum.repos.d/local.repo Add the following lines: [local] name=Local DVD or ISO repository baseurl= file:///mnt/dvd gpgcheck=0 enabled=1 Step 3: Test your local repository I installing nginx package using local repository. [huupv@huupv huuphan.com]$  yum install --disablerepo="*" --enablerepo="local" nginx

How to Install sublime text editor on Fedora with DNF

Image
In this tutorial, How to Install sublime text editor on Fedora with DNF. Sublime Text is a powerful tool for web developer. I love it Install sublime Text editor Use sublime official yum repository for fedora system. Open terminal and import gpg $ sudo rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg $ sudo dnf config-manager --add-repo https://download.sublimetext.com/rpm/stable/x86_64/sublime-text.repo Install sublime text latest version your system. $ sudo dnf install sublime-text Access sublime text Yeah coding :)

Recover Data from Crashed Disks with ddrescue command

How to save and recover Data from Crashed Disks with ddrescue command? This is program is useful to rescue data in case I/O error. How to solve problem “wrong fs type, bad option, bad superblock” error? mount: wrong fs type, bad option, bad superblock on 192.168.1.155:/home/shared, missing codepage or helper program, or other error (for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program)  In some cases useful info is found in syslog - try dmesg | tail or so. My server OS: Centos 7 HDD1: /dev/sda1 HDD2: /dev/sdb1 ( mount point /mnt) HDD2: /dev/sdb1 is crash, not mount pint /mnt. How to do it! I attach a new HDD3 disk: /dev/sdc1 on my system. use ddrescue command. Install ddrescue on centos # yum install ddrescue How do I use ddrescue command rescue a partition in /dev/sdb1 to /dev/sdc1 ## is damaged, you will need to recreate it somehow on /dev/sdb. ## ddrescue -f -n /dev/sdb /dev/sdc logfile ddrescue -d -f -r3 /dev/sdb /dev/s

How to using NGINX Multiple ssl certificates on one ip

Image
I experienced setup and configure nginx multiple domain on one VPS. In this tutorial, How to using NGINX Multiple ssl certificates on one ip. Multiple SSL Certificates use letsencrypt Web server: Nginx Two domain: domain1.com domain2.cm IP VPS: 111.111.111.222 You buy VPS linux and configure multiple domain on one ip VPS server. I use VPS linode.com cheap 5 USD/month. I love it! Nginx Redirect all HTTP requests to HTTPS server {         listen 80;         listen [::]:80 ipv6only=on;         if ($host = www.domain1.com) {         return 301 https://$host$request_uri;         }         if ($host = www.domain2.com) {         return 301 https://$host$request_uri;         }         server_name www.domain1.com domain1.com www.domain2.com domain2.com;         return 444; } Nginx config for domain1.com server {         listen 443 ssl http2;         listen [::]:443 ssl http2;         server_name www.domain1.com domain1.com;         root /path/to/do

How to setup OpenVPN Server on Centos 7

In this tutorial, I will setup OpenVPN Server on Centos 7.   Step 1: Prepare install OpenVPN server sudo yum update -y sudo yum install epel-release -y sudo yum update -y sudo yum install -y openvpn easy-rsa Configure Ip forwarding for OpenVPN Server vim /etc/sysctl.conf The content sysctl.conf file as below: Packet forwarding net.ipv4.ip_forward = 1   Step 2: Configure OpenVPN Server Open server.conf file vim /etc/openvpn/server.conf The content configure as below: #Secure OpenVPN Server Config #Basic Connection Config dev tun proto udp port 1194 keepalive 10 120 max-clients 4 #Certs ca ca.crt cert server.crt key server.key dh dh.pem tls-auth ta.key 0 #Ciphers and Hardening reneg-sec 0 remote-cert-tls client crl-verify crl.pem tls-version-min 1.2 cipher AES-256-CBC auth SHA512 tls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA256:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-128-CBC-SHA256 #D

Failed to create the VirtualBox COM object solve problem

Image
Someday, your Virtualbox not start and the display error "Failed to create the VirtualBox COM object". it got somewhat corrupted. The error of Virtualbox "Failed to create the VirtualBox COM object" as below: Location: '/home/huupv/.config/VirtualBox/VirtualBox.xml' , line 1 (0), column 1. /home/vbox/vbox-5.2.14/src/VBox/Main/src-server/VirtualBoxImpl.cpp[554] (nsresult VirtualBox::init()). How to solve problem! Step 1: make sure process VBoxSVC not running Step 2: make a copy file VirtualBox.xml then delete original file. Step 3: Rename VirtualBox.xml-prev file to VirtualBox.xml file. Step 4: try again start VirtualBox. To check not running process VBoxSVC not running use ps command as below: $ ps -ef | grep VBoxSVC huupv 10122 2421 0 22:19 pts/1 00:00:00 grep --color=auto VBoxSVC To check VirtualBox.xml file and Delete VirtualBox.xml file $ ll /home/huupv/.config/VirtualBox/ | grep VirtualBox.xml -rw-----

How to connect openvpn server from a linux computer

Image
Connect access server (VPS) from a linux computer. In this tutorial, I will access server VPS installed OpenVPN server from a linux computer. Ref to How to setup OpenVPN Server on Centos 7 Install openvpn client on linux Run Openvpn client with .ovpn file for example: client.ovpn Install OpenVPN client on linux  Fedora/CentOS/RedHat client sudo yum install openvpn Ubuntu/Debian client sudo apt-get install openvpn Checking Openvpn client version [huupv@huupv ~]$ openvpn --version The output as below: OpenVPN 2.4.6 x86_64-redhat-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Apr 26 2018 library versions: OpenSSL 1.1.0h-fips  27 Mar 2018, LZO 2.08 Running the OpenVPN client linux computer with the downloaded client config ovpn file: [huupv@huupv vpn-client-01-config]$ sudo openvpn --config client.ovpn The output OpenVPN client linux connect to server OpenVPN server as below: Sun Jul  1 21:43:35 2018 TUN/TAP device tun0 open

How to NGINX Solution for Apache ProxyPassReverse

Image
NGINX Solution for Apache ProxyPassReverse Apache configure <VirtualHost myhost:8888>     ServerName myhost     DocumentRoot /path/to/myapp/public     ProxyPass / http://myapp:8080/     ProxyPassReverse / http://myapp:8080/ </VirtualHost> Nginx Reverse Proxy Configure Nginx not have ProxyPassReverse. Therefore a few missing HTTP header. Solve problem Nginx for Apache ProxyPassReverse as below: server {     listen 80;     server_name  www.huuphan.com;     location /home {     proxy_set_header Host $host;         proxy_pass http://IP_Apache:8888;     }     location /app {     proxy_set_header Host $host;         proxy_set_header X-Forwarded-Host $host:$server_port;         proxy_set_header X-Forwarded-Server $host;         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;         proxy_pass http://IP_TOMCAT:8080;     } }

Configure Postfix to use Gmail as a Mail Relay

In this tutorial, I setup and Configure Postfix to use Gmail as a Mail Relay with 587 port. OS : Centos User : root Install postfix yum install postfix mailx cyrus-sasl cyrus-sasl-plain To configure postfix to use Gmail as a Mail Relay vi /etc/postfix/main.cf Add or modify the following as below: #To use smpt gmail with 587 port relayhost = [smtp.gmail.com]:587 smtp_use_tls = yes smtp_sasl_auth_enable = yes smtp_sasl_security_options = noanonymous smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt smtp_tls_security_level = encrypt # Location of CA certificates smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt To configure Gmail authentication vi /etc/postfix/sasl_passwd Add the line as below: [smtp.gmail.com]:587    [email protected]:password Running commands as below: chmod 600 /etc/postfix/sasl_passwd chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db postmap /etc/postfix/sasl_pas

Nginx redirect all http to https

In this tutorial, How to use nginx redirect all http to https. All traffic http redirect to https for your website. How to do it..... For example, nginx.conf file for your website     server {             listen 80;             listen [::]:80;             if ($host = www.huuphan.com) {                return 301 https://$host$request_uri;            }             if ($host = huuphan.com) {               return 301 https://$host$request_uri;             }             server_name www.huuphan.com huuphan.com;             return 444;             #return 301 https://$server_name$request_uri;     }     server {             listen 443 ssl http2;             listen [::]:443 ssl http2;             server_name www.huuphan.com huuphan.com;             access_log off;             error_log /path/to/logs/error.log;             root /path/to/webroot;             index index.php index.html index.htm;             location / {                try_files $uri $uri/ /index.php?$

How To Install Wordpress with nginx on CentOS 6

Image
How To Install Wordpress with nginx on CentOS 6. In this posts, the tutorial to install and configure mysql, wordpress and nginx on centos 6 step by step. I'm running account huupv as "root" privilege . Links to below you maybe likes: How to install php7 on centos 6 How to install and configure redmine on centos 6 How to owncloud 9 install ssl certificate centos 7 How To Install the BIND DNS Server on CentOS 6 KeepAlived IP Failover on CentOS & Red Hat To release version on your server cat /etc/redhat-release The output as bellow CentOS release 6.9 (Final) To update server sudo yum update To install epel-release sudo yum install epel-release To install nginx sudo yum install nginx sudo /etc/init.d/nginx start sudo yum install php-fpm php-mysql php-gd To install and configure mysql sudo yum install mysql-server sudo /etc/init.d/mysqld restart sudo /usr/bin/mysql_secure_installation To add user and database for WP_HuuPV on Mysql mysql -u root -p

How to configure ntp client server

Image
CentOS / Red Hat Configure ntp(Network time protocol) client server synchronised. NTP client ----> NTP server (192.16.1.10) To configure ntp on ntp server To configure allow port 123 on IPtables firewalls cat /etc/sysconfig/iptables The output as bellow -A INPUT -p tcp -m state --state NEW --dport 123 -j ACCEPT -A INPUT -p udp -m state --state NEW --dport 123 -j ACCEPT To configure ntp.conf file restrict 127.0.0.1 restrict 192.16.1.0 netmask 255.255.255.0 nomodify notrap restrict 172.235.0.0 netmask 255.255.0.0 nomodify notrap restrict -6 ::1 server 0.centos.pool.ntp.org iburst server 1.centos.pool.ntp.org iburst server 2.centos.pool.ntp.org iburst server 3.centos.pool.ntp.org iburst server 0.asia.pool.ntp.org server 1.asia.pool.ntp.org server 2.asia.pool.ntp.org server 3.asia.pool.ntp.org To configure ntp on ntp client To configure allow port 123 on IPtables firewalls cat /etc/sysconfig/iptables The output as bellow -A OUTPUT -d 192.16.1.10/32 -m state --stat

How to enable swap-drive on linux

Image
in my post, How to enable swap-drive on linux. The solve problem "Swap Not working" on linux such as centos, Fedora 25.  The open terminal, to check status of swap space ( as run root account) . swapon -s lsblk As the content below NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT sr0     11:0    1  1024M  0 rom sda      8:0    0 465.8G  0 disk ├─sda4   8:4    0 202.1G  0 part ├─sda2   8:2    0 105.9G  0 part / ├─sda5   8:5    0  12.9G  0 part [SWAP] ├─sda3   8:3    0     1K  0 part ├─sda1   8:1    0   487M  0 part └─sda6   8:6    0 144.4G  0 part /media/installed To turn on swap-drive /dev/sda5 swapon /dev/sda5 To make this permanent start-up on the system vim /etc/fstab  As the content below /dev/sda5 swap swap defaults 0 0 To check, if swap drive that work! free -h As the content below               total        used        free      shared  buff/cache   available Mem:           3.6G        2.2G        123M        321M        1.3G        

How to install ibus-bogo on fedora 25

Image
How to install ibus-bogo on fedora 25. I'm running commands as privileged ! To download ibus-bogo-0.4-12.fc26.noarch.rpm wget https://kojipkgs.fedoraproject.org//packages/ibus-bogo/0.4/12.fc26/noarch/ibus-bogo-0.4-12.fc26.noarch.rpm To install ibus-bogoon fedora 25 sudo rpm -ivh ibus-bogo-0.4-12.fc26.noarch.rpm  To configure ibus-bogo on fedora 25 ibus-daemon & ibus restart ibus-setup  Note: for program writen QT, example: skype... vim ~/.bash_profile The content as following: export GTK_IM_MODULE=ibus export QT4_IM_MODULE=xim export QT_IM_MODULE=xim export XMODIFIERS=@im=ibus To after, logout and login. Thanks for reading!

How to install mediawiki on centos 6

Image
Links to below you maybe likes: How to install php7 on centos 6 How to install and configure redmine on centos 6 How to owncloud 9 install ssl certificate centos 7 How To Install the BIND DNS Server on CentOS 6 KeepAlived IP Failover on CentOS & Red Hat How to install mediawiki on centos 6 To require nginx php MySQL Step 1: To update and install epel repo, ntpd #yum update -y #yum install -y epel-release #yum install -y ntp #chkconfig ntpd on #ntpdate pool.ntp.org #service ntpd start Step 2: To install the dependencies #yum install gd sendmail gcc pcre yum-utils wget Step 3:  To install php7 for nginx remi centos 6 Step 4: To install ImageMagick #yum install php-mbstring php-fpm php-devel php-mysql php-pear ImageMagick ImageMagick-devel --enablerepo=remi-php70 #pecl install imagick #echo "extension=imagick.so" > /etc/php.d/imagick.in Step 5: To enable module php-mbstring for nginx #find / -name mbstring.so The result /opt/remi/php70/roo

How to install php7 on centos 6

Image
How to install php7 on centos 6, I'm use remi repo to install remi-php70. I'm running commands as root account. To install php7  yum install wget yum-utils wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6.rpm yum-config-manager --enable remi-php70 yum install php --enablerepo=remi-php70 To check for available repositories yum repolist For example: To install php7 for nginx ( Due to, nginx use php-fpm and php-mysql) yum install php-fpm php-mysql --enablerepo=remi-php70 Thanks for reading! How to install php7 on centos 6

How to install and configure redmine on centos 6

Image
How to install and configure redmine on centos 6. I'm running commands as root account! Links to below you maybe likes: How to install php7 on centos 6 How to install and configure redmine on centos 6 How to owncloud 9 install ssl certificate centos 7 How To Install the BIND DNS Server on CentOS 6 KeepAlived IP Failover on CentOS & Red Hat To require install redmine on centos 6 CentOS is installed and works Nginx   is installed and works MySQL is installed and works Your are logged as root To install the the dependence packages yum update yum install -y wget gcc gcc-c++ mysql-server mysql-devel openssl-devel readline-devel zlib-devel curl-devel libxslt-devel pcre ImageMagick-devel yum install -y epel-release  yum install -y ntp chkconfig ntpd on ntpdate pool.ntp.org service ntpd start To install ruby on centos 6 cd /usr/local/src/ wget -qO- https://cache.ruby-lang.org/pub/ruby/stable/ruby-2.3.4.tar.gz | tar xvz cd ruby-2.3.4/ ./configure --disable-inst

curl: (35) SSL connect error

Image
How to solve problem " curl: (35) SSL connect error " For example, curl command to https://huuphan.com error and appear code 35 error as below [root@huupv httpdocs]# curl -v https://huuphan.com * About to connect() to huuphan.local port 443 (#0) *   Trying xxx.xxx.xxx.xxx... connected * Connected to huuphan.com (xxx.xxx.xxx.xxx) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb *   CAfile: /etc/pki/tls/certs/ca-bundle.crt   CApath: none * NSS error -5990 * Closing connection #0 * SSL connect error curl: (35) SSL connect error Solve problem: To update curl and nss package For centos: # yum update curl nss For ubuntu: #apt-get update curl nss

How to owncloud 9 install ssl certificate centos 7

Image
How to owncloud 9 install ssl certificate centos 7. in the previous, how to install owncloud 9 in centos 7 To install  mod SSL #yum install mod_ssl To create new certificate #mkdir /etc/httpd/ssl #openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/httpd/ssl/owncloud.key -out /etc/httpd/ssl/owncloud.pem Adjusting /etc/httpd/conf.d/owncloud.conf file <VirtualHost *:80>     DocumentRoot /var/www/html/owncloud/     Redirect permanent / https://172.16.235.145/     <Directory /var/www/html/owncloud>         Options FollowSymLinks MultiViews         AllowOverride ALL         Order allow,deny         allow from all     </Directory> </VirtualHost> <VirtualHost *:443>     SSLEngine on     SSLCertificateFile /etc/httpd/ssl/owncloud.pem     SSLCertificateKeyFile /etc/httpd/ssl/owncloud.key     DocumentRoot /var/www/html/owncloud/     <Directory /var/www/html/owncloud>         Options FollowSymLinks MultiViews    

How to install owncloud 9 centos 7

Image
How to install owncloud 9 on centos 7. I'm use bash script to install owncloud 9 on centos 7. Links to below you maybe likes: How to install php7 on centos 6 How to install and configure redmine on centos 6 How to owncloud 9 install ssl certificate centos 7 How To Install the BIND DNS Server on CentOS 6 KeepAlived IP Failover on CentOS & Red Hat #!/bin/bash #Full Name: Phan Van Huu #My Blog: www.huuphan.com #How to install owncloud 9 centos 7 #To update centos 7 echo -e "Updating pack for centos 7\n" yum install -y vim wget yum -y update #To install Mariadb server for centos 7 echo -e "Installing MariaDB server for centos 7\n" yum install -y mariadb-server systemctl enable mariadb systemctl start mariadb #To set password root for MariaDB server echo -e "To set password root for MariaDB server\n" mysqld_safe --skip-grant-tables --skip-networking & 1>/dev/null mysql -u root -e 'FLUSH PRIVILEGES;' mysql -u root -e