Sunteți pe pagina 1din 30

Boot Loader

Boot Loader di Linux ada 2 macam,yaitu :


1. Lilo
2. Grub

Grub = Grand Unified Bootloader

Contoh isi file /boot/grub2/grub.cfg:


menuentry 'CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class
gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-514.el7.x86_64-advanced-
62507bb4-3cb4-4b1c-8ace-39c72c561b31' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-
baremetal=ahci0,msdos1 --hint='hd0,msdos1' 1ded91fa-5114-41d8-8a97-3e7cc8d1e474
else
search --no-floppy --fs-uuid --set=root 1ded91fa-5114-41d8-8a97-3e7cc8d1e474
fi
linux16 /vmlinuz-3.10.0-514.el7.x86_64 root=/dev/mapper/centos-root ro
rd.lvm.lv=centos/swap vconsole.keymap=us rd.lvm.lv=centos/root vconsole.font=latarcyrheb-sun16
rhgb quiet LANG=en_US.UTF-8
initrd16 /initramfs-3.10.0-514.el7.x86_64.img
}

Grubby
adalah salah satu tool atau command yang digunakan dalam memaintain grub versi 2.

Menampilkan Default kernel


[root@localhost ~]# grubby ­­default­kernel 
/boot/vmlinuz­3.10.0­514.26.2.el7.x86_64

Menampilkan Nomer Index Kernel


[root@localhost ~]# grubby ­­default­index 

Menampilkan menuentry GRUB Kernel


[root@localhost ~]# grubby ­­info=ALL 
index=0 
kernel=/boot/vmlinuz­3.10.0­514.26.2.el7.x86_64 
args="ro  rd.lvm.lv=centos/swap vconsole.keymap=usrep  
rd.lvm.lv=centos/root vconsole.font=latarcyrheb­sun16 rhgb quiet 
LANG=en_US.UTF­8" 
root=/dev/mapper/centos­root 
initrd=/boot/initramfs­3.10.0­514.26.2.el7.x86_64.img 
title=CentOS Linux (3.10.0­514.26.2.el7.x86_64) 7 (Core) 
index=1 
kernel=/boot/vmlinuz­3.10.0­514.el7.x86_64 
args="ro  rd.lvm.lv=centos/swap vconsole.keymap=us 
rd.lvm.lv=centos/root vconsole.font=latarcyrheb­sun16 rhgb quiet 
LANG=en_US.UTF­8" 
root=/dev/mapper/centos­root 
initrd=/boot/initramfs­3.10.0­514.el7.x86_64.img 
title=CentOS Linux (3.10.0­514.el7.x86_64) 7 (Core) 
index=2 
kernel=/boot/vmlinuz­0­rescue­1d29f24ab4184414b186c992a9208fc6 
args="ro  rd.lvm.lv=centos/swap vconsole.keymap=us 
rd.lvm.lv=centos/root vconsole.font=latarcyrheb­sun16 rhgb quiet" 
root=/dev/mapper/centos­root 
initrd=/boot/initramfs­0­rescue­1d29f24ab4184414b186c992a9208fc6.img
title=CentOS Linux (0­rescue­1d29f24ab4184414b186c992a9208fc6) 7 
(Core) 
index=3 
non linux entry

Mengubah Default Boot Entry


[root@localhost ~]# grubby ­­set­default /boot/vmlinuz­3.10.0­
514.el7.x86_64 

Atau bisa menggunakan langkah seperti dibawah ini:


Konfigurasi Utama Boot Loader
[root@localhost ~]# vi /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=vg_training/lv_swap 
rd.lvm.lv=vg_training/lv_root crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

mengganti seting "default"


[root@localhost ~]# vim /etc/default/grub
GRUB_TIMEOUT=10
GRUB_DEFAULT=2

# Untuk menjadi permanent lakukan perintah dibawah ini:
[root@localhost ~]# grub2­mkconfig ­o /boot/grub2/grub.cfg
[root@localhost ~]# reboot
Seting Grub versi 1 di CentOS-6,

[root@localhost ~]# vi /boot/grub/menu.lst
default=1  ­­> urutan default title
timeout=10 ­­> waktu 
splashimage=(hd0,0)/boot/grub/splash.xpm.gz 
hiddenmenu 
title CentOS (2.6.32­358.el6.x86_64) ­­> nama title
        root (hd0,0) ­­> menyatakan /root berada hd0=hardisk pertama
dan ,0 = partisi pertama 
        kernel /boot/vmlinuz­2.6.32­358.el6.x86_64 ro root=UUID= 
rhgb quiet ­­> lokasi kernel 
        initrd /boot/initramfs­2.6.32­358.el6.x86_64.img ­­> lokasi 
image kernel
title CentOS BUDI 
        root (hd0,0) 
        kernel /boot/vmlinuz­2.6.32­358.el6.x86_64 ro 
root=UUID=b0c24ec8 rhgb quiet 
        initrd /boot/initramfs­2.6.32­358.el6.x86_64.img 
title Cen 
        root (hd0,0) 
        kernel /boot/vmlinuz­2.6.32­358.el6.x86_64 ro 
root=UUID=b0c24ec8­e4 rhgb quiet 
        initrd /boot/initramfs­2.6.32­358.el6.x86_64.img
Reset Password Root
1. Masuk ke bootloader
2. Tahan menu bootloader dengan menggerakan tanda arah panah atas dan kebawah
3. Tekan esc pada menu bootloader
4. Tekan kembali e dan highlight/sorot ke bagian kernel
5. Tambahkan di bagian akhir “linux16...” kernel, seperti : “ ...rw init=/bin/bash”.
Dah hapus option "rhgb", "quiet", "LANG=***", seperti contoh dibawah ini :

linux16 /vmlinuz-3.10.0-327.4.4.el7.x86_64 root=/dev/mapper/centos-root \


ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap console=ttyS0,115200n8
systemd.debug rw init=/bin/bash

6. Tekan “Ctrl+x” untuk booting


7. Ganti password root
# touch /.autorelabel
# passwd
# exec /sbin/init
SUDO

Sudo adalah singkatan dari Super User DO, yang diartikan sebuah user biasa yang memiliki
privileges administrator.

su = switch user

Untuk memberikan sebuah privileges user admin, kita bisa mengubah user tersebut dengan perintah
[root@localhost ~]# usermod -G wheel sandi
keterangan:
usermod : command user mode
wheel : group administrator yang dimiliki oleh CentOS
sandi : user biasa

Untuk melakukan 'custom' privileges bisa diubah dengan visudo


[root@localhost ~]# rpm -qa | grep sudo
[root@localhost ~]# visudo
----------
## User Aliases
## These aren't often necessary, as you can use regular groups
## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname
## rather than USERALIAS
# User_Alias ADMINS = jsmith, mikem
User_Alias ADMINS = student
----
## Command Aliases
## These are groups of related commands...
Cmnd_Alias MAKINGUSER = /usr/sbin/useradd, /usr/bin/passwd
----
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
ADMINS ALL=(ALL) NOPASSWD: MAKINGUSER

Cara penggunaan SUDO


[root@localhost ~]# su - student
[student@localhost ~]$ sudo useradd budi
[student@localhost ~]$ sudo passwd budi
RPM & TAR (Tarbal)
Install paket rpm
(Download terlebih dahulu paket teamviewer yang berekstention .rpm)
[root@localhost ~]# rpm ­ivh teamviewer_linux.rpm

Jika error disebabkan Failed dependencies, install terlebih dahulu paket dependency tersebut,
contoh
error: Failed dependencies:
libSM.so.6 is needed by teamviewer-11.0.57095-0.i686
libasound.so.2 is needed by teamviewer-11.0.57095-0.i686
libdbus-1.so.3 is needed by teamviewer-11.0.57095-0.i686
libjpeg.so.62 is needed by teamviewer-11.0.57095-0.i686
libpng12.so.0 is needed by teamviewer-11.0.57095-0.i686

maka install terlebih dahulu paket diatas, seperti :


[root@localhost ~][# yum install libuuid.i686 libpng12.i686 libjpeg­
turbo.i686 libSM.i686 libICE.i686 dbus­libs.i686  alsa­lib.i686

Ulangi install teamviewer


[root@localhost ~]# rpm ­ivh teamviewer.i686.rpm
sukses

Atau ALTERNATIVE install dengan perintah yum :

[root@localhost ~]# yum install ­y teamviewer.i686.rpm
sukses
Install Paket Tarbal (.TAR)
Langkah instalasi dari source pidgin

1. Ekstrak paket pidgin


[root@localhost ~]# tar ­jxvf pidgin­2.10.1.tar.bz2
[root@localhost ~]# cd pidgin­2.10.1

2. Configure.
[root@localhost ~]# ./configure ­­prefix=/usr/local/pidgin 
­­disable­screensaver ­­disable­startup­notification ­­with­python 
­­disable­vv ­­disable­idn ­­disable­avahi ­­disable­sm 

Paket yang dibutuhkan;


intltool
glib2-devel
gtk2-devel
libpng-devel
gtkspell-devel
libxml2-devel
gstreamer-devel
meanwhile-devel
dbus-glib-devel
NetworkManager-devel
gnutls-devel
tcl-devel
tk-devel
mod_perl-devel
[root@localhost ~]#

3. Compile.
[root@localhost ~]# make

4. Copy
[root@localhost ~]# make install

5. Testing
[root@localhost ~]# /usr/local/pidgin/bin/pidgin
Installation HP LaserJet P1005, P1006, P1007, P1008, P1505

1. Download your “foo2xqx” in foo2zjs.tar.gz packages


[root@localhost ~]# wget ­O foo2zjs.tar.gz 
http://foo2zjs.rkkda.com/foo2zjs.tar.gz 

2. Unpack foo2zjs.tar.gz packages


[root@localhost ~]# tar zxf foo2zjs.tar.gz 
[root@localhost ~]# cd foo2zjs 
3. Compile
[root@localhost foo2zjs]# make
catatan: jika ada error, install paket gcc, bc dan foomatic.

4. Download firmware
– Get HP LaserJet P1005 firmware file –
[root@localhost foo2zjs]# ./getweb P1005
note: to get other firmware with other typical printer

5. Install driver
[root@localhost foo2zjs]# make install

6. Configure hot plug (USB support)


[root@localhost foo2zjs]# make install­hotplug 

7. If using CUPS, restart the spooler


[root@localhost foo2zjs]# make cups 

8. Configure your printer using gnome printer configuration, click System -> Administration ->
Printing

9. Another way, you can run printer administration using CUPS at http://localhost:631/

10. Select your printer, this an example


Printer Name   : HP_LaserJet_P1005_USB_1 
Description    : HP LaserJet P1005 
Location       : Local Printer 
Printer Driver : HP LaserJet P1505 Foomatic/foo2xqx (recommended) 
Device URI     : usb://HP/LaserJet%20P1005 

Catatan: silakan cek driver printer terbaru di


http://www.openprinting.org/printers
Script CentOS
Contoh script
case.sh
[student@localhost ~]$ vi case.sh
#!/bin/bash 
case $1 in 
    start) 
    echo "starting program......."; 
    ;; 
    stop) 
    echo "stopping program......."; 
    ;; 
    restart) 
    echo "restart program......."; 
    ;; 
   *) 
echo "usage or gunakan seperti : sh $0 start|stop|restart" 
;; 
esac 

Mengubah permission file execute :


[student@localhost ~]$ chmod u+x case.sh
atau
[student@localhost ~]$ chmod 744 case.sh

Execute file :
[student@localhost ~]$ ./case.sh
atau
[student@localhost ~]$  sh case.sh
declare.sh

[student@localhost ~]$ vi declare.sh
#!/bin/bash 
declare ­i num 
num=1 
num=5+num 
echo $num

floating.sh

[student@localhost ~]$ vi floating.sh
#!/bin/bash 
num=`echo "scale=5; 13 / 2" | bc` 
echo $num

fungsi.sh

[student@localhost ~]$ vi fungsi.sh
#!/bin/bash 
# skrip sederhana demonstrasi penggunaan fungsi 
function keluar () 

   exit 

function cetak () 

echo "hello world" 

if.sh

[student@localhost ~]$ vi if.sh
#!/bin/bash 
echo "Hello world" 
echo "ini shell script pertama saya!"

if2.sh

[student@localhost ~]$ vi if2.sh
#!/bin/bash 
echo ­n "Masukkan sebuah password : " 
read password 
if [ "$password" = "asli" ]; then 
echo "you're right." 
else 
echo "you're wrong." 
fi

kegiatan.sh

[student@localhost ~]$ vi kegiatan.sh
#!/bin/bash 
echo ­n "sedanga apa?" 
read kegiatan 
echo "selamat $kegiatan!"

let.sh

[student@localhost ~]$ vi let.sh
#!/bin/bash 
num=1 
let num=5+num 
echo $num

let2.sh

[student@localhost ~]$ vi let2.sh
#!/bin/bash 
num=1 
(( num+=5 )) 
echo $num 

login.sh

[student@localhost ~]$ vi login.sh
#!/bin/bash 
user=`whoami` 
echo "Anda login dengan account : $user"

while.sh

[student@localhost ~]$ vi while.sh
#!/bin/bash 
COUNTER=0 
while [ $COUNTER ­lt  5 ]; do 
  echo "counter = " $COUNTER 
  let COUNTER=COUNTER+1 
done
while2.sh

[root@localhost ~]$ vi while2.sh
#!/bin/bash 
COUNTER=5 
until [ $COUNTER ­lt 0  ]; do 
  echo "counter = " $COUNTER 
  let COUNTER=COUNTER­1 
done

Login terlebih dahulu sebagai user root

[root@localhost ~]# vi tambah_user.sh
#!/bin/bash 
jumlah=`wc ­l user.db | awk '{print $1}'` 
for ((i=1;i<=jumlah;i++)); do 
  user=`head ­$i user.db | tail ­1 | awk '{print $1}'` 
  pass=`head ­$i user.db | tail ­1 | awk '{print $2}'` 
useradd $user 
echo "$pass" | passwd ­­stdin $user 
done

membuat database
[root@localhost ~]# vi user.db
bea bea123 
ukie ukie123

Mengubah permission file execute :


[root@localhost ~]# chmod u+x tambah_user.sh

Execute file :
[root@localhost ~]# ./tambah_user.sh
atau
[root@localhost ~]#  sh tambah_user.sh
Xinetd
Tool xinetd berfungsi untuk mengumpulkan service berbagai aplikasi menjadi satu daemon/engine,
biasanya yang tidak memiliki service / daemon sendiri.
Contoh, ftp server (tftp)

Install terlebih dahulu paket telnet-server


[root@server ~]# yum install xinetd tftp tftp­server

kemudian, edit file telnet di :


[root@server ~]# vim /etc/xinetd.d/tftp
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = ­s /var/lib/tftpboot
        disable                 = yes → no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

[root@server ~]# vim /var/lib/tftpboot/test.txt
[root@server ~]# systemctl stop tftp.service 

Menjalankan service xinetd


[root@server ~]# systemctl restart xinetd
[root@server ~]# systemctl enable xinetd

Mengakses telnet server menggunakan terminal:


 student@ubuntu:~$ tftp 192.168.5.240
tftp> get test.txt
Sent 159 bytes in 0.0 seconds

tftp> quit

cat test
Backup

Untuk backup ada berbagai macam media :


1. hardisk

2. type

3. CD/DVD

4. Network (server backup)

Langkah backup via CD/DVD;


1. membuat file image, iso (image source)
[root@localhost ~]# mkisofs ­r ­J ­o file_backup.iso /dir_backup

2. proses burning
[root@localhost ~]# cdrecord 

contoh:
# Membuat folder mounting iso dan folder link backup
[root@localhost ~]# mkdir /mnt/iso /mnt/burn 

# Link folder /etc yang akan dibackup
[root@localhost ~]# ln ­s /etc  /mnt/burn 

# Link folder /home
[root@localhost ~]# ln ­s /home /mnt/burn 

# Membuat file iso 
[root@localhost ~]# mkisofs ­f ­r ­J ­o /mnt/backup.iso /mnt/burn 

Catatan: kalo sudah pernah mengaktifkan teamviewer, silakan remove terlebih dahulu
directory /home/'user'/.local/share/teamviewer*. Kemudian ulangi kembali.
# Cek hasil backup dengan melakukan proses mounting iso terlebih 
dahulu
[root@localhost ~]# mount /mnt/backup.iso /mnt/iso ­o loop 

# Melihat hasil mounting/backup
[root@localhost ~]# ls /mnt/iso 
contoh;

* Script Backup dengan menggunakan NFS Server


Host B (192.168.5.245)
[root@localhost ~]# yum install nfs­utils
[root@localhost ~]# vi /etc/exports
/home/nfs 192.168.5.244(rw,sync,no_root_squash,no_all_squash)

[root@localhost ~]# mkdir /home/nfs
[root@localhost ~]# systemctl start rpcbind
[root@localhost ~]# systemctl start nfs­server

Host A
[root@localhost ~]# vi /usr/bin/backup.sh 
 
#!/bin/sh 
#################################### 

# Backup to NFS mount script. 

#################################### 

# What to backup. 
backup_files="/etc " 

# Where to backup to. 
dest="/mnt/backup" 

# Create archive filename. 
day=$(date +%F) 
hostname=$(hostname ­s) 
archive_file="$hostname­$day.tgz" 

# Print start status message. 
echo "Backing up $backup_files to $dest/$archive_file" 
date 
echo 

# Backup the files using tar. 
 tar czf $dest/$archive_file $backup_files 

# Print end status message. 
echo 
echo "Backup finished" 
date 

# Long listing of files in $dest to check file sizes. 
ls ­lh $dest 

# Menseting permission file backup.sh
[root@localhost ~]# chmod u+x /usr/bin/backup.sh

# Mounting NFS Client (A)
[root@localhost ~]# mount  192.168.5.245:/home/nfs  /mnt/backup

# Menjalankan script backup.sh
[root@localhost ~]# ./backup.sh 

simpan script backup.sh di crontab (schedulling) 

* Script Backup dengan menggunakan NFS Server 2

Host B (192.168.5.245)
[root@localhost ~]# yum install nfs­utils
[root@localhost ~]# vi /etc/exports
/home/nfs        192.168.5.244(rw,sync,no_root_squash,no_all_squash)

Host A (192.168.5.244)
[root@localhost ~]# vi /usr/bin/backup­new.sh
#!/bin/sh

#####################################

# Backup to NFS mount script.

#####################################

# Make Folder
dirA="burn"
dirB="nfs"
dir_backup1="/etc"
dir_backup2="/home"
nfs_server="192.168.5.245"

# Link Folder
mkdir /mnt/$dirA /mnt/$dirB
ln ­s $dir_backup1 /mnt/$dirA
ln ­s $dir_backup2 /mnt/$dirA

# Mount folder NFS
mount $nfs_server:/home/nfs  /mnt/$dirB
# Create foldername.
waktu=$(date +%T)
hostname=$(hostname ­s)
folder_name="$hostname­$waktu.iso"

# Make ISO file
mkisofs ­f ­r ­J ­o /mnt/$dirB/backup­$folder_name /mnt/$dirA

# Print end status message.
echo
echo "Backup finished"
date

# Menseting permission file backup.sh
[root@localhost ~]# chmod u+x /usr/bin/backup­new.sh

# Menjalankan script backup.sh
[root@localhost ~]# backup­new.sh 

simpan script backup.sh di crontab (schedulling) 

# Menseting permission file backup.sh
[root@localhost ~]# chmod u+x /usr/bin/backup­new.sh

# Menjalankan script backup.sh
[root@localhost ~]# backup­new.sh 

simpan script backup.sh di crontab (schedulling) 

* Backup dengan menggunakan metode Rsync :


Case : Terdapat server production (192.168.5.244) dan backup (192.168.5.245)

1. Pertama Lakukan Seting di server production (source).


[root@pro ~]# yum ­y install rsync
# specify files or directories you'd like to exclude to copy
[root@pro ~]# vi /etc/rsync_exclude.lst
test
test.txt

2. Kemudian lakukan Configure pada server backup (destination host).


[root@backup ~]# yum ­y install rsync
[root@backup ~]# vi /etc/rsyncd.conf
# any name you like
[backup]
# destination directory for copy
path = /home/backup
# hosts you allow to access
hosts allow = 192.168.5.244
hosts deny = *
list = true
uid = root
gid = root
read only = false

# membuat folder
[root@backup ~]# mkdir /home/backup

# Service rsyncd
[root@backup ~]# systemctl start rsyncd 
[root@backup ~]# systemctl enable rsyncd 

3. Setelah itu lakukan Execute rsync pada server Production (Source Host) seperti dibawah ini:
[root@pro ~]# rsync ­avz ­­delete ­­exclude­
from=/etc/rsync_exclude.lst /root/work

192.168.5.245::backup

# Add in cron if you'd like to run reguraly
[root@pro ~]# crontab ­e
# for example, run at 2:00 AM in a day
00 02 * * * rsync ­avz ­­delete ­­exclude­
from=/etc/rsync_exclude.lst /root/work/

192.168.5.245::backup
Crontab
Crontab adalah aplikasi scheduller berbentuk table

Mengecek aplikasi sudah terinstall atau belum


[root@localhost ~]# rpm ­qa | grep cron
cronie­1.4.11­14.el7_2.1.x86_64
crontabs­1.11­6.20121102git.el7.noarch
cronie­anacron­1.4.11­14.el7_2.1.x86_64

[root@localhost ~]# 

Menjalankan crontab
[root@localhost ~]# crontab ­e

Menseting crontab:
0 22 * * * /usr/bin/backup.sh

Menjalan service crontab


[root@localhost ~]# systemctl start crond
INIT/run level
Run Level adalah Tingkatan Level proses yang terdapat pada OS Linux, dimana kita bisa mengecek
runlevel server dengan cara:
[root@localhost ~]# runlevel
N5
berarti Server kita running di level 5

Mengaktifkan run level 1:


[root@localhost ~]# init 1
[root@localhost ~]# init 5

Query or send control commands to the systemd manager


[root@localhost ~]# systemctl ­­help

[root@localhost ~]# systemctl list­unit­files
UNIT FILE                                    STATE   
proc­sys­fs­binfmt_misc.automount            static  
dev­hugepages.mount                          static  
dev­mqueue.mount                             static  
proc­fs­nfsd.mount                           static  
proc­sys­fs­binfmt_misc.mount                static  
sys­fs­fuse­connections.mount                static  
sys­kernel­config.mount                      static  
sys­kernel­debug.mount                       static  
tmp.mount                                    disabled
var­lib­nfs­rpc_pipefs.mount                 static  
brandbot.path                                disabled
cups.path                                    enabled 
systemd­ask­password­console.path            static  
Partisi Hardisk

Melihat Partisi yang ada


[root@localhost ~]# fdisk ­l
Disk /dev/sda: 80.0 GB,

  Device Boot  Start     End      Blocks   Id  System
/dev/sda1   *   1        2550    20480000   83  Linux
/dev/sda2       2550     2805     2048000   82  Linux swap / Solaris
/dev/sda3       2805     7905    40960000   83  Linux
keterangan : 
+ Disk /dev/sda 
+ besar hardisk :  80.0 GB
+ umlah partisi : 3 (sda1, sda2, sda3)

Melihat file system tab


[root@localhost ~]# cat /etc/fstab

UUID=a9f5ac03­  /        ext4   defaults  1 1
UUID=6266e184­  /home    ext4   defaults  1 2
UUID=dc975e4d­  swap     swap   defaults  0 0
tmpfs           /dev/shm tmpfs  defaults  0 0
devpts          /dev/pts devpts gid=5,mode=620  0 0
sysfs           /sys     sysfs  defaults  0 0
proc            /proc    proc   defaults  0 0

keterangan:
fs_specs   fs_fde   fs_vfstype   fs_mntops   fs_freq   fspassno

Memulai partisi hardisk


1. Memulai partisi hardist

[root@localhost ~]# fdisk /dev/sda

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
Command (m for help): p
Disk /dev/sda: 80.0 GB, 80025280000 bytes

255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b53b4

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2550    20480000   83  Linux
/dev/sda2            2550        2805     2048000   82  Linux swap /
Solaris
/dev/sda3            2805        7905    40960000   83  Linux

2. Menambah partisi baru (n)


Command (m for help): n

Command action
   e   extended
   p   primary partition (1­4)
e
Selected partition 4
First cylinder (7905­9729, default 7905): 
Using default value 7905
Last cylinder, +cylinders or +size{K,M,G} (7905­9729, default 9729):
Using default value 9729

Command (m for help): p

Disk /dev/sda: 80.0 GB, 80025280000 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b53b4

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2550    20480000   83  Linux
/dev/sda2            2550        2805     2048000   82  Linux swap /
Solaris
/dev/sda3            2805        7905    40960000   83  Linux
/dev/sda4            7905        9729    14659168+   5  Extended

Command (m for help): n
First cylinder (7905­9729, default 7905): 
Using default value 7905
Last cylinder, +cylinders or +size{K,M,G} (7905­9729, default 9729):
10G
Value out of range.
Last cylinder, +cylinders or +size{K,M,G} (7905­9729, default 9729):
+10G

Command (m for help): p

Disk /dev/sda: 80.0 GB, 80025280000 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes/ro

Disk identifier: 0x000b53b4
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2550    20480000   83  Linux
/dev/sda2            2550        2805     2048000   82  Linux swap /
Solaris
/dev/sda3            2805        7905    40960000   83  Linux
/dev/sda4            7905        9729    14659168+   5  Extended
/dev/sda5            7905        9210    10490269+  83  Linux

3. Mengubah type partisi 5 (/dev/sda5)


Command (m for help): t
Partition number (1­5): 5

Hex code (type L to list codes): L

0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris


1 FAT12 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 40 Venix 80286 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 41 PPC PReP Boot 85 Linux extended c7 Syrinx
5 Extended 42 SFS 86 NTFS volume set da Non-FS data
6 FAT16 4d QNX4.x 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS 4e QNX4.x 2nd part 88 Linux plaintext de Dell Utility
8 AIX 4f QNX4.x 3rd part 8e Linux LVM df BootIt
9 AIX bootable 50 OnTrack DM 93 Amoeba e1 DOS access
a OS/2 Boot Manag 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 52 CP/M 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 54 OnTrackDM6 a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 5c Priam Edisk a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 61 SpeedStor a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary
16 Hidden FAT16 64 Novell Netware af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 65 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 70 DiskSecure Mult b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 75 PC/IX bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 80 Old Minix be Solaris boot ff BBT
1e Hidden W95 FAT1

Hex code (type L to list codes): 7
Changed system type of partition 5 to 7 (HPFS/NTFS)

Command (m for help): p

Disk /dev/sda: 80.0 GB, 80025280000 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000b53b4

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2550    20480000   83  Linux
/dev/sda2            2550        2805     2048000   82  Linux swap /
Solaris
/dev/sda3            2805        7905    40960000   83  Linux
/dev/sda4            7905        9729    14659168+   5  Extended
/dev/sda5            7905        9210    10490269+   7  HPFS/NTFS

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re­read partition table.

WARNING: Re­reading the partition table failed with error 16: Device
or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

[root@localhost ~]# reboot

4. Memformat partisi baru


[root@localhost ~]# yum install ntfsprogs ntfsprogs­devel
[root@localhost ~]# mkfs.ntfs /dev/sda5
Cluster size has been automatically set to 4096 bytes.
Initializing device with zeroes: 100% ­ Done.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
[root@localhost ~]#

5. Mounting folder filesystem ntfs


[root@localhost ~]# mkdir /win7
[root@localhost ~]# mount.ntfs­3g /dev/sda5 /win7
[root@localhost ~]# mkdir /win7/Documents
[root@localhost ~]# umount /win7
[root@localhost ~]# vi /etc/fstab
...
/dev/sda5    /win7    ntfs­3g  defaults        0 0
Quota
Tools :
[root@localhost ~]# yum install quota

Konfigurasi :
1. Mengaktifkan option quota dengan menambahkan usrquota,grpquota di file /etc/fstab
[root@localhost ~]# vim /etc/fstab 
UUID=6266e184­   /home    ext4  defaults,usrquota,grpquota     1 2 
 
keterangan, menambahkan option "usrquota,grpquota" 
[root@localhost ~]# mount ­o remount /home 
 

2. mengecek dan mengaktifkan quota


[root@localhost ~]# quotaoff ­avug
[root@localhost ~]# quotacheck ­avugm
[root@localhost ~]# quotaon ­avug 

3. membuat quota

[root@localhost ~]# setquota ­a student 100000 100000 100000 100000
keterangan kapasitas 100 Megabyte (hard soft) batas inode inode di 
hardisk 

4. melihat quota user


[root@localhost ~]# edquota ­u student
[root@localhost ~]# edquota ­T  ­­­­>grace block/inode

5. melihat report quota

[root@localhost ~]# repquota ­a
Compilie Kernel
Kernel merupakan core dari sistem operasi
di dalam sebuah sistem operasi sendiri mempunyai 2 tipe kernel, yaitu :
1. Monolitik
contoh, linux,mac
keuntungan lebih stabil
kerugian, untuk instalasi lebih sulit

2. Modular
contoh, windows
Keuntungan lebih mudah instalasi
Kerugian, cendrung tidak stabil

Pada saat melakukan compile kernel kita akan diminta untuk melakukan beberapa pilihan
modul/driver yang dimiliki oleh kernel tersebut, dimana pilihan tersebut berupa:
 Y[*] monolitik
 M[*] modular
 N[ ] none, tidak dipilih (default)
linux module = driver hardware
semakin banyak yang diminta untuk masing-masing kernel semakin lama proses Compile

perhatikan dari pilihan kernel (make menuconfig) untuk processor (biasanya monolitik) dan
network bersifat modular

Install kernel via elrepo.org:


[root@localhost ~]# rpm ­­import https://www.elrepo.org/RPM­GPG­KEY­
elrepo.org
[root@localhost ~]# rpm ­Uvh http://www.elrepo.org/elrepo­release­
7.0­2.el7.elrepo.noarch.rpm

[root@localhost ~]# yum ­­enablerepo=elrepo­kernel install kernel­ml

Compile kernel via Source:


Untuk melakukan compile kernel, pastikan paket-paket dibawah ini sudah di install terlebih dahulu;

autoconf
automake
bc
bison
byacc
flex
gcc
gcc-c++
gettext
libpciaccess
libpciaccess-devel (this by default is not installed)
libstdc++ (for x86_64 systems)
libtool
make
ncurses-devel
patch
rpm-build
man

Adapun langkah-langkah compile kernel, bisa dilakukan dibawah ini :


Dapatkan source kernel yang terbaru dan stable dari www.kernel.org, dalam hal ini kita
menggunakana kernel linux-3.18.4.tar.xz

Install Paket Depedency :

[root@localhost ~]# yum install autoconf automake bc bison byacc flex gcc gcc-c++ gettext
libpciaccess libpciaccess-devel libstdc++ libtool make ncurses-devel patch rpm-build man ncurses
ncurses-devel libelf-devel or elfutils-libelf-devel openssl openssl-devel

[root@localhost ~]# yum update -y

Unpack(ekstrak):
[root@localhost ~]# tar ­xf linux­3.18.4.tar.xz ­C /usr/src/

Masuk ke direktory ekstraks:
[root@localhost ~]# cd /usr/src/linux­3.18.4

Lakukan Configure :
[root@localhost linux­3.18.4]# make menuconfig
Disini kita bisa memilih kebutuhan device modul atau driver hardware
kita:
Contoh:
Device Drivers ­> Network device support ­> Ethernet (10000 Mbit)
Intel(R) 10GbE PCI Express adapters support
atau secara default saja.
*Save the new kernel configuration

[root@localhost linux­3.18.4]# make oldconfig

Compile :
[root@localhost linux­3.18.4]# make

Installing ke dalam system :
[root@localhost linux­3.18.4]# make modules_install install

Reboot system :
[root@localhost linux­3.18.4]# reboot

catatan:
http://linoxide.com/linux-how-to/upgrade-linux-kernel-stable-3-18-4-centos/
Networking
Untuk mengecek informasi jaringan bisa menggunakan ipcalc
[root@localhost ~]# yum install ipcalc 
[root@localhost ~]$ ipcalc 192.168.5.0/24 

Wakeonlan
Untuk server yang dijadikan target lakukan seting terlebih dahulu seperti dibawah ini:

[root@localhost ~]# yum ­y install ethtool
[root@localhost ~]# ethtool ­s enp2s0 wol g
[root@localhost ~]# vi /etc/sysconfig/network­scripts/ifcfg­enp2s0
# tambahkan pada akhir baris 
ETHTOOL_OPTS="wol g"

#Coba cek MACADDRESS:
[root@localhost ~]# ifconfig enp2s0 | grep ether | awk '{print $2}'
1c:1b:0d:06:e1:6f

#Shutdown
[root@localhost ~]# shutdown ­h now

Untuk client coba install paket (dalam hal ini 64-bit)

[root@localhost ~]# yum ­y install net­tools
[root@localhost ~]# ether­wake ­i enp2s0 1b:0d:06:e1:6f

atau

[root@localhost ~]# rpm ­Uvh wol­0.7.1­4.el7.x86_64.rpm
[root@localhost ~]# wol 1c:1b:0d:06:e1:6f

Seting IP Address di CentOS 7

# set hostname
[root@localhost ~]# hostnamectl set­hostname cherly.com

# display devices
[root@cherly ~]# nmcli d 
DEVICE       TYPE      STATE      CONNECTION
enp2s0       ethernet  connected  enp2s0
lo           loopback  unmanaged  ­­
# set IPv4 address ⇒ nmcli *** [IP address]
[root@cherly ~]# nmcli c modify enp2s0 ipv4.addresses 192.168.6.245/24
 
# set default gateway
[root@cherly ~]# nmcli c modify enp2s0 ipv4.gateway 192.168.6.1

# set DNS
[root@cherly ~]# nmcli c modify enp2s0 ipv4.dns 192.168.6.1

# set manual for static setting (it's "auto" for DHCP)
[root@cherly ~]# nmcli c modify enp2s0 ipv4.method manual

# restart the interface and reload the settings
[root@cherly ~]# nmcli c down enp2s0; nmcli c up enp2s0

S-ar putea să vă placă și