Welcome to My Website

=== TECHNO-BLOG ===
Dalam blog ini saya ingin berbagi pengalaman dengan semua orang yang membaca blog saya.

Bagi anda yang tertarik dengan fasilitas yang ada dalam Blog saya silahkan kirimkan e-mail anda ke alamat:

cyberman.777@gmail.com


--- Selamat Datang Di Blog Saya ----- Welcome To My Blog --- Selamat Datang Di Blog Saya ----- Welcome To My Blog --- Selamat Datang Di Blog Saya ----- Welcome To My Blog --- Selamat Datang Di Blog Saya ----- Welcome To My Blog --- Selamat Datang Di Blog Saya ----- Welcome To My Blog --- Selamat Datang Di Blog Saya ----- Welcome To My Blog --- Selamat Datang Di Blog Saya ----- Welcome To My Blog --- Selamat Datang Di Blog Saya ----- Welcome To My Blog --- Selamat Datang Di Blog Saya ----- Welcome To My Blog --- Selamat Datang Di Blog Saya ----- Welcome To My Blog --- Selamat Datang Di Blog Saya ----- Welcome To My Blog ---
Tampilkan postingan dengan label RedHat. Tampilkan semua postingan
Tampilkan postingan dengan label RedHat. Tampilkan semua postingan

Mengganti Nama Host / HostName di CentOS RedHat

Diposting oleh Nurman Nurhakim 10 Mei 2019 0 komentar

Berikut cara untuk mengganti HostName di CentOS atau RedHat

[root@centos ~]# vi /etc/hosts
[root@centos ~]#



[root@centos ~]# vi /etc/hostname
[root@centos ~]#



[root@centos ~]# cat /etc/hostname
[root@centos ~]#




Dalam artikel kali ini saya akan sharring bagaimana caranya untuk merubah IP Address di CentOS-7 atau RedHat-7 :

-Cek nama interface (apakah eth0, ens160, enp0s3, dll)

nmcli d




[root@centos ~]# nmcli d
DEVICE  TYPE      STATE      CONNECTION
ens160  ethernet  connected  ens160
lo      loopback  unmanaged  --
[root@centos ~]#


-Cek IP Address Sebelum di ubah : 192.168.88.100

ifconfig



[root@centos ~]# ifconfig
ens160: flags=4163  mtu 1500
        inet 192.168.88.100  netmask 255.255.255.0  broadcast 192.168.88.255
        inet6 fe80::20c:29ff:fe5a:6451  prefixlen 64  scopeid 0x20
        ether 00:0c:29:5a:64:51  txqueuelen 1000  (Ethernet)
        RX packets 635505  bytes 70327985 (67.0 MiB)
        RX errors 0  dropped 24  overruns 0  frame 0
        TX packets 13861  bytes 2584969 (2.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

-Barulah kita ubah IP Address nya menjadi : 192.168.88.110

vi /etc/sysconfig/network-scripts/ifcfg-ens160



[root@centos ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens160
TYPE=Ethernet
BOOTPROTO=static
IPADDR=192.168.88.110
NETMASK=255.255.255.0
GATEWAY=192.168.88.1
DNS1=8.8.8.8
DNS2=202.159.32.2
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
#IPV6INIT=no
#IPV6_AUTOCONF=no
#IPV6_DEFROUTE=no
#IPV6_PEERDNS=no
#IPV6_PEERROUTES=no
#IPV6_FAILURE_FATAL=no
NAME=ens160
UUID=921dab9c-9209-4a61-b1e5-f5ee5d96d349
DEVICE=ens160
ONBOOT=yes
[root@centos ~]#

setelah di ubah jangan lupa di save :wq

-Setelah dilakukan perubahan ip kita wajib merestart service networknya agar IP barunya aktif :



service network restart
atau
/etc/init.d/network restart


-Setelah restart service kita coba akses dan membuka terminal kembali menggunakan IP Baru



 IP Telah berganti menjadi IP Baru 192.168.88.110

Script CentOS RedHat Mengecek IP ADDRESS

Diposting oleh Nurman Nurhakim 0 komentar

Berikut Script untuk mengecek IP Address pada CentOS dan RedHat



ifconfig

[root@centos ~]# ifconfig
ens160: flags=4163  mtu 1500
        inet 192.168.88.100  netmask 255.255.255.0  broadcast 192.168.88.255
        inet6 fe80::20c:29ff:fe5a:6451  prefixlen 64  scopeid 0x20
        ether 00:0c:29:5a:64:51  txqueuelen 1000  (Ethernet)
        RX packets 620208  bytes 69236740 (66.0 MiB)
        RX errors 0  dropped 24  overruns 0  frame 0
        TX packets 13680  bytes 2557071 (2.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


ip add

[root@centos ~]# ip add

2: ens160: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:5a:64:51 brd ff:ff:ff:ff:ff:ff
    inet 192.168.88.100/24 brd 192.168.88.255 scope global noprefixroute ens160
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe5a:6451/64 scope link
       valid_lft forever preferred_lft forever
[root@centos ~]#




Dalam tulisan kali ini saya akan sharring cara untuk membuat user baru di CentOS atau RedHat, dengan privilage Super User yang bisa Sudo, Oke langsung saja Check This Out :


adduser nama_user_baru     (membuat user baru)

passwd nama_user_baru     (memberikan password login user baru)

Contoh :
[root@centos ~]# adduser nurman
[root@centos ~]# passwd nurman
Changing password for user nurman.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@centos ~]#



Cek apakah User tersebut sudah ada :



[root@centos ~]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
nurman:x:1000:1000::/home/nurman:/bin/bash
[root@centos ~]#


Agar user ini bisa melakukan Sudo (Super User)

-install sudo (jika di server belum ada) yum install sudo (pastikan server bisa konek inet) :



-cari file name : "sudoers" di dalam directory /etc/ :


[root@centos ~]# cd /etc/
[root@centos etc]# ls -la | grep sudo
-rw-r-----.   1 root root      1786 Oct 30  2018 sudo.conf
-r--r-----.   1 root root      4328 Oct 30  2018 sudoers
drwxr-x---.   2 root root         6 Oct 31  2018 sudoers.d
-rw-r-----.   1 root root      3181 Oct 30  2018 sudo-ldap.conf
[root@centos etc]#

-edit previlage file sudoers : chmod 777 sudoers



-edit isi dari file sudoers : vi sudoers (kalo prefilagenya read only ganti dulu) chmod 777 sudoers
-atau ketik : visudo


-root     ALL=(ALL)     ALL 
-tambahkan
-nurman      ALL=(ALL)     ALL 
-jangan lupa di save :wq!

-kembalikan lagi ke semula previlage file sudoers :chmod 440 sudoers



Kemudian kita coba login menggunakan User yang telah kita buat tadi :



login as: nurman
nurman@192.168.88.100's password:
[nurman@centos ~]$ sudo su

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for nurman:
[root@centos nurman]#

Script CentOS RedHat Mengecek Proses yang Sedang Berjalan (task manager)


ps aux

[root@centos ~]# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.3  46192  6496 ?        Ss   May08   0:05 /usr/lib/systemd/systemd --system --deserialize 17
root         2  0.0  0.0      0     0 ?        S    May08   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    May08   0:00 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S<   May08   0:00 [kworker/0:0H]
root         7  0.0  0.0      0     0 ?        S    May08   0:00 [migration/0]
root         8  0.0  0.0      0     0 ?        S    May08   0:00 [rcu_bh]
root         9  0.0  0.0      0     0 ?        R    May08   0:02 [rcu_sched]
root        10  0.0  0.0      0     0 ?        S<   May08   0:00 [lru-add-drain]
root        11  0.0  0.0      0     0 ?        S    May08   0:00 [watchdog/0]
root        13  0.0  0.0      0     0 ?        S    May08   0:00 [kdevtmpfs]
root        14  0.0  0.0      0     0 ?        S<   May08   0:00 [netns]
root        15  0.0  0.0      0     0 ?        S    May08   0:00 [khungtaskd]
root        16  0.0  0.0      0     0 ?        S<   May08   0:00 [writeback]
root        17  0.0  0.0      0     0 ?        S<   May08   0:00 [kintegrityd]
root        18  0.0  0.0      0     0 ?        S<   May08   0:00 [bioset]
root        19  0.0  0.0      0     0 ?        S<   May08   0:00 [bioset]
root        20  0.0  0.0      0     0 ?        S<   May08   0:00 [bioset]
root        21  0.0  0.0      0     0 ?        S<   May08   0:00 [kblockd]
root        22  0.0  0.0      0     0 ?        S<   May08   0:00 [md]
root        23  0.0  0.0      0     0 ?        S<   May08   0:00 [edac-poller]
root        24  0.0  0.0      0     0 ?        S<   May08   0:00 [watchdogd]
root        30  0.0  0.0      0     0 ?        S    May08   0:00 [kswapd0]
root        31  0.0  0.0      0     0 ?        SN   May08   0:00 [ksmd]
root        32  0.0  0.0      0     0 ?        SN   May08   0:00 [khugepaged]
root        33  0.0  0.0      0     0 ?        S<   May08   0:00 [crypto]
root        41  0.0  0.0      0     0 ?        S<   May08   0:00 [kthrotld]
root        42  0.0  0.0      0     0 ?        S    May08   0:00 [kworker/u2:1]
root        43  0.0  0.0      0     0 ?        S<   May08   0:00 [kmpath_rdacd]





top

top - 10:32:50 up 1 day, 17:58,  2 users,  load average: 0.00, 0.01, 0.05
Tasks: 104 total,   1 running, 103 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1882620 total,  1031720 free,   148580 used,   702320 buff/cache
KiB Swap:  2097148 total,  2097148 free,        0 used.  1490816 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
    1 root      20   0   46192   6496   3956 S  0.0  0.3   0:05.37 systemd
    2 root      20   0       0      0      0 S  0.0  0.0   0:00.01 kthreadd
    3 root      20   0       0      0      0 S  0.0  0.0   0:00.24 ksoftirqd/0
    5 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kworker/0:0H
    7 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 migration/0
    8 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcu_bh
    9 root      20   0       0      0      0 S  0.0  0.0   0:02.36 rcu_sched
   10 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 lru-add-drain
   11 root      rt   0       0      0      0 S  0.0  0.0   0:00.30 watchdog/0
   13 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kdevtmpfs
   14 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 netns
   15 root      20   0       0      0      0 S  0.0  0.0   0:00.08 khungtaskd
   16 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 writeback
   17 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kintegrityd
   18 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
   19 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
   20 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
   21 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kblockd
   22 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 md
   23 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 edac-poller
   24 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 watchdogd
   30 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kswapd0
   31 root      25   5       0      0      0 S  0.0  0.0   0:00.00 ksmd





netstat -tapn

[root@centos ~]# netstat -tapn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      5297/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      5604/master
tcp        0     64 192.168.88.100:22       192.168.88.12:59758     ESTABLISHED 16363/sshd: root@pt
tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd
tcp6       0      0 :::22                   :::*                    LISTEN      5297/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      5604/master





netstat -tapn | grep sshd

[root@centos ~]# netstat -tapn | grep sshd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      5297/sshd
tcp        0     64 192.168.88.100:22       192.168.88.12:59758     ESTABLISHED 16363/sshd: root@pt
tcp6       0      0 :::22                   :::*                    LISTEN      5297/sshd
[root@centos ~]#






netstat -tapn | grep 22

[root@centos ~]# netstat -tapn | grep 22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      5297/sshd
tcp        0     64 192.168.88.100:22       192.168.88.12:59758     ESTABLISHED 16363/sshd: root@pt
tcp6       0      0 :::22                   :::*                    LISTEN      5297/sshd
[root@centos ~]#








Melihat Aplikasi atau Paket Tertentu yang Terinstall 


rpm -qa | grep nama_aplikasi

Contoh :
[root@centos ~]# rpm -qa | grep tcpdump
tcpdump-4.9.2-3.el7.x86_64
[root@centos ~]#
[root@centos ~]# rpm -qa | grep openssl
openssl-libs-1.0.2k-16.el7_6.1.x86_64
openssl-1.0.2k-16.el7_6.1.x86_64



Melihat Seluruh Aplikasi atau Paket yang Terinstall 


rpm -qa 

Contoh :
[root@centos ~]# rpm -qa
man-pages-3.53-5.el7.noarch
harfbuzz-1.7.5-2.el7.x86_64
glusterfs-api-3.12.2-18.el7.x86_64
grub2-common-2.02-0.76.el7.centos.1.noarch
libini_config-1.3.1-32.el7.x86_64
kbd-misc-1.15.5-15.el7.noarch
yum-plugin-fastestmirror-1.1.31-50.el7.noarch
audit-2.8.4-4.el7.x86_64
compat-libical1-1.0.1-2.el7.x86_64
biosdevname-0.7.3-1.el7.x86_64
libselinux-2.5-14.1.el7.x86_64
hardlink-1.0-19.el7.x86_64
fxload-2002_04_11-16.el7.x86_64
ledmon-0.90-1.el7.x86_64
perl-Getopt-Long-2.40-3.el7.noarch
cdparanoia-libs-10.2-17.el7.x86_64
tcpdump-4.9.2-3.el7.x86_64
libattr-2.4.46-13.el7.x86_64
crash-trace-command-2.0-14.el7.x86_64
libgpg-error-1.12-3.el7.x86_64
libpng-1.5.13-7.el7_2.x86_64
policycoreutils-2.5-29.el7_6.1.x86_64
ps_mem-3.1-7.el7.noarch
audit-libs-2.8.4-4.el7.x86_64
cups-libs-1.6.3-35.el7.x86_64
sg3_utils-1.37-17.el7.x86_64
dbus-glib-0.100-7.el7.x86_64
libnl3-3.2.28-4.el7.x86_64
libstoragemgmt-python-1.6.2-4.el7.noarch




Melihat Paket tertentu yang terdapat dalam Repository Yum yang Terinstall


yum list | grep nama_paket

Contoh :
[root@centos ~]# yum list | grep openssh
openssh.x86_64                              7.4p1-16.el7               @base
openssh-clients.x86_64                      7.4p1-16.el7               @base
openssh-server.x86_64                       7.4p1-16.el7               @base
openssh-askpass.x86_64                      7.4p1-16.el7               base
openssh-cavs.x86_64                         7.4p1-16.el7               base
openssh-keycat.x86_64                       7.4p1-16.el7               base
openssh-ldap.x86_64                         7.4p1-16.el7               base

openssh-server-sysvinit.x86_64              7.4p1-16.el7               base




Melihat Seluruh Paket yang terdapat dalam Repository Yum yang Terinstall


yum list

Contoh :
[root@centos ~]# yum list | more
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.dionipe.net
 * extras: mirror.dionipe.net
 * updates: mirror.dionipe.net
Installed Packages
GConf2.x86_64                               3.2.6-8.el7                @anaconda
GeoIP.x86_64                                1.5.0-13.el7               @base
NetworkManager.x86_64                       1:1.12.0-10.el7_6          @updates
NetworkManager-libnm.x86_64                 1:1.12.0-10.el7_6          @updates
NetworkManager-ppp.x86_64                   1:1.12.0-10.el7_6          @updates
NetworkManager-team.x86_64                  1:1.12.0-10.el7_6          @updates
NetworkManager-tui.x86_64                   1:1.12.0-10.el7_6          @updates
OpenEXR-libs.x86_64                         1.7.1-7.el7                @anaconda
PyGreSQL.x86_64                             4.0-9.el7                  @anaconda
abrt.x86_64                                 2.1.11-52.el7.centos       @base
abrt-addon-ccpp.x86_64                      2.1.11-52.el7.centos       @base
abrt-addon-kerneloops.x86_64                2.1.11-52.el7.centos       @base
abrt-addon-pstoreoops.x86_64                2.1.11-52.el7.centos       @base
abrt-addon-python.x86_64                    2.1.11-52.el7.centos       @base
abrt-addon-vmcore.x86_64                    2.1.11-52.el7.centos       @base
abrt-addon-xorg.x86_64                      2.1.11-52.el7.centos       @base
abrt-cli.x86_64                             2.1.11-52.el7.centos       @base
abrt-console-notification.x86_64            2.1.11-52.el7.centos       @base
abrt-dbus.x86_64                            2.1.11-52.el7.centos       @base
abrt-libs.x86_64                            2.1.11-52.el7.centos       @base
abrt-python.x86_64                          2.1.11-52.el7.centos       @base
abrt-retrace-client.x86_64                  2.1.11-52.el7.centos       @base
abrt-tui.x86_64                             2.1.11-52.el7.centos       @base
acl.x86_64                                  2.2.51-14.el7              @base
adwaita-cursor-theme.noarch                 3.28.0-1.el7               @base
aic94xx-firmware.noarch                     30-6.el7                   @anaconda
alsa-firmware.noarch                        1.0.28-2.el7               @anaconda
alsa-lib.x86_64                             1.1.6-2.el7                @base
alsa-tools-firmware.x86_64                  1.1.0-1.el7                @base
apr.x86_64                                  1.4.8-3.el7_4.1            @base
apr-util.x86_64                             1.5.2-6.el7                @anaconda
at.x86_64                                   3.1.13-24.el7              @base
atk.x86_64                                  2.28.1-1.el7               @base
attica.x86_64                               0.4.2-1.el7                @base
attr.x86_64                                 2.4.46-13.el7              @base
audit.x86_64                                2.8.4-4.el7                @base
audit-libs.i686                             2.8.4-4.el7                @base
audit-libs.x86_64                           2.8.4-4.el7                @base
augeas-libs.x86_64                          1.4.0-6.el7_6.1            @updates
authconfig.x86_64                           6.2.8-30.el7               @base
autofs.x86_64                               1:5.0.7-99.el7             @base
avahi-autoipd.x86_64                        0.6.31-19.el7              @base

avahi-libs.x86_64                           0.6.31-19.el7              @base


--- Terima Kasih telah Mengunjungi Blog Saya ----- Thank You for Visiting My Blog --- Terima Kasih telah Mengunjungi Blog Saya ----- Thank You for Visiting My Blog --- Terima Kasih telah Mengunjungi Blog Saya ----- Thank You for Visiting My Blog --- Terima Kasih telah Mengunjungi Blog Saya ----- Thank You for Visiting My Blog --- Terima Kasih telah Mengunjungi Blog Saya ----- Thank You for Visiting My Blog --- Terima Kasih telah Mengunjungi Blog Saya ----- Thank You for Visiting My Blog --- Terima Kasih telah Mengunjungi Blog Saya ----- Thank You for Visiting My Blog --- Terima Kasih telah Mengunjungi Blog Saya ----- Thank You for Visiting My Blog --- Terima Kasih telah Mengunjungi Blog Saya ----- Thank You for Visiting My Blog --- Terima Kasih telah Mengunjungi Blog Saya ----- Thank You for Visiting My Blog --- Terima Kasih telah Mengunjungi Blog Saya ----- Thank You for Visiting My Blog ---

************** Choose Language : **************

English French German Spain Italian Dutch

Russian Portuguese Japanese Korean Arabic Chinese Simplified
    === TEKNO-SCIENCE ===

    **************************************

    free counters

    ********* Tentang Saya : *********