Please Wait, Loading...

Thursday 20 July 2017

27 Hal Paska Install CentOS 7

Semoga bermanfaat :
1. Register and Enable Red Hat Subscription
    # yum install subscription-manager register
    # subscription-manager register --username your_username --password your_password
    # subscription-manager unregister --> untuk unregister
    # subscription-manager list -available --> melihat daftar
    # subscription-manager subscribe --pool=Pool ID number  --> aktivasi
    # subscription-manager list –consumed --> melihat status
    # subscription-manager list --> cek enable
    # subscription-manager remove --all  --> menhapus keaktifan
    # subscription-manager unsubscribe --serial=Serial number --> menhapus keaktifan
    # subscription-manager service-level --list
    # subscription-manager service-level --set=self-support
    # subscription-manager repos --list --> enable repolist
   
2. Configure Network with Static IP Address
    # yum install net-tools             [Provides ifconfig utility]
    # ip addr show
    # vi /etc/sysconfig/network-scripts/ifcfg-eth0
        TYPE=Ethernet
        BOOTPROTO=static
        NAME=eth0
        UUID=a487343f-625a-4408-97ad-ac6745726316
        DEVICE=eth0
        ONBOOT=yes
        NM_CONTROLLED=yes
        IPADDR=192.168.20.61
        PREFIX=24
        GATEWAY=192.168.20.2
        DNS1=192.168.20.1
    # service network restart.1
    # ip addr show
    # ping -c4 google.com
  
    CREATE VHOST CentOS 7
    # cd /etc/httpd/
    # mkdir sites-available sites-enabled
    # vi conf/httpd.conf --> tambahkan IncludeOptional sites-enabled/*.conf
    # vi /etc/httpd/sites-available/rheltest.lan.conf --> isikan sperti dibawah ini :
        <VirtualHost *:80>
            ServerName rheltest.lan
            DocumentRoot "/var/www/rheltest.lan"
            <Directory "/var/www/rheltest.lan">
            Options Indexes FollowSymLinks MultiViews
            # AllowOverride controls what directives may be placed in .htaccess files.    
            AllowOverride All
            # Controls who can get stuff from this server file
            Order allow,deny
            Allow from all
            </Directory>
            <IfModule mpm_peruser_module>
            ServerEnvironment apache apache
            </IfModule>
            ErrorLog  /var/log/httpd/rheltest.lan-error.log
            CustomLog /var/log/httpd/rheltest.lan-access.log combined
        </VirtualHost>
    # mkdir -p /var/www/rheltest.lan
    # nano /usr/local/bin/a2ensite  --> isikan :
            #!/bin/bash
            if test -d /etc/httpd/sites-available && test -d /etc/httpd/sites-enabled  ; then
                echo "-----------------------------------------------"
                else
                mkdir /etc/httpd/sites-available
                mkdir /etc/httpd/sites-enabled
            fi
          
            avail=/etc/httpd/sites-available/$1.conf
            enabled=/etc/httpd/sites-enabled/
            site=`ls /etc/httpd/sites-available/`
            if [ "$#" != "1" ]; then
                echo "Use script: a2ensite virtual_site"
                echo -e "\nAvailable virtual hosts:\n$site"
                exit 0
            else
                if test -e $avail; then
                    sudo ln -s $avail $enabled
                else
                    echo -e "$avail virtual host does not exist! Please create one!\n$site"
                exit 0
                fi
                if test -e $enabled/$1.conf; then
                    echo "Success!! Now restart Apache server: sudo systemctl restart httpd"
                else
                    echo  -e "Virtual host $avail does not exist!\nPlease see available virtual hosts:\n$site"
                exit 0
                fi
            fi
  
    # nano /usr/local/bin/a2dissite  --> isikan :
        #!/bin/bash
        avail=/etc/httpd/sites-enabled/$1.conf
        enabled=/etc/httpd/sites-enabled
        site=`ls /etc/httpd/sites-enabled/`
        if [ "$#" != "1" ]; then
            echo "Use script: a2dissite virtual_site"
            echo -e "\nAvailable virtual hosts: \n$site"
        exit 0
        else
            if test -e $avail; then
                sudo rm  $avail
            else
                echo -e "$avail virtual host does not exist! Exiting!"
            exit 0
            fi
            if test -e $enabled/$1.conf; then
                echo "Error!! Could not remove $avail virtual host!"
            else
                echo  -e "Success! $avail has been removed!\nPlease restart Apache: sudo systemctl restart httpd"
            exit 0
            fi
        fi
      
    # chmod +x /usr/local/bin/a2*
    # a2ensite vhost_name
    # a2disite vhost_name  
    # a2ensite rheltest.lan
    # systemctl restart httpd
    # buka browser test rheltest.lan
 

Posted By adminblog15:56

Solusi Error "bringing up interface eth0 error connection activation failed.." CentOS 7

Konfigurasi dibawah ini, bisa mengakibatkan error system khususnya di kondisi remote. Hal ini akan ditengarai ketika server melakukan proses restarting network. Dan bagaimana solusinya :

[root@srv1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

TYPE=Ethernet
BOOTPROTO=static
NAME=eth0
UUID=a487343f-625a-4408-97ad-ac6745726316
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.2.61
PREFIX=24
GATEWAY=192.168.20.2
DNS1=192.168.20.1

Berikut ialah solusinya :
 
[root@srv1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

TYPE=Ethernet
BOOTPROTO=static
NAME=eth0
UUID=a487343f-625a-4408-97ad-ac6745726316
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.2.61
PREFIX=24
GATEWAY=192.168.20.2
DNS1=192.168.20.1

NM_CONTROLLED=no   ---> tambahkan NM_CONTROLLED

Sederhana dan semoga bermanfaat. 


Posted By adminblog14:11