Posted in Certification, Linux Foundation (LFCE & LFCS)

LFCE Catatan 2

Network filesystems and file services

  1. Configure systems to mount standard, encrypted and network file systems on demand
  2. Create, mount and unmount standard Linux file systems
  3. Provide/configure network shares via NFS
  4. Transfer files securely via the network
  5. Update packages from the network, a repository or the local file system
    Mount StandardLFCE
    #gdisk /dev/sdc 
    #whatis gdisk
    #mkfs-t ext4 /dev/sdc1 
    #mount -t /ext4 /dev/sdc1 /directory 
    #df -h
    #umount /directory 
    #mount /dev/sdc1 /directory 
    #vim /etc/fstab     
            /dev/sdc1    /mnt/directory     ext4    defaults    0 0 
    #mount -a
    Encrypted Filesystems 
    #grep -i config_dm_crypt /boot/config-$(uname -r)
     Hasilnya : CONFIG_DM_CRYPT=m
    #lsmod | grep dm_crypt
    #yum install cryptsetup
    #fdisk -l 
     fdisk /dev/sdb 
        n  = new partition
        p  = primary partition
        1  = number 1 
        w  = write 
     fdisk - =l /dev/sdb1 
    #whatis cryptsetup 
     -> manage plain dm-crypt and LUKS encrypted volumes
    #cryptsetup -y luksFormat /dev/sdb1 
     -> Masukkan passphrase
     -> Verify passphrase 
    #cryptsetup --version
    #cryptsetup -> USAGE 
    #cd /proc/; cat crypto 
    #cryptsetup luksOpen /dev/sdb1 MyEncrypt
     -> Masukkan passphrase
    #mkfs -t ext4 /dev/sdb1 
    #mkfs -t ext4 /dev/mapper/MyEncrypt
    #cd /mnt; mkdir encrypt 
    #mount /dev/mapper/MyEncrypt /mnt/encrypt
    #df -h 
    #umount /mnt/encrypt
    #cryptsetup luksClose MyEncrypt 
    #cryptsetup luksOpen /dev/sdb1 mnt/encrypt
    #mount /dev/mapper/MyEncrypt /mnt/encrypt
    #cd /encrypt; ll 
    #echo "encryption" > encryption
    #umount /mnt/encrypt
    #cryptsetup luksOpen MyEncrypt
    Mount Standard - NFS 
    #mkdir nfsdir 
    #ssh -l yudha 192.168.65.130 
    $cat /etc/exports
    $exit
    #cd /mnt/; ll; mkdir nfsdir; ll
    #mount -t nfs 192.168.65.130:/home nfsdir/
    #df -h 
    #cd /nfsdir; ll 
    #cd /mnt; ll 
    #umount /nfsdir
    #vim /etc/fstab 
        192.168.65.130:/home    /mnt/nfsdir        nfs    rw,sync,hard,intr 0 0 
    #df -h 
    #mount nfsdir/; df -h 
    #umount nfsdir/
    #mkdir partition 
    #mount -a; df -h
    Mount & Umount 
    #fdisk -l 
    #cat /etc/fstab 
    #fdisk /dev/sdb 
        p = print 
        l = list 
        n = new 
        1 = partition number
        w = write 
    #fdisk -l /dev/sdb
    #mkfs -t ext4 /dev/sdb1 
    #cd /media; mkdir sdb[12];
    #mount -t ext4 /dev/sdb1 /media/sdb1;df -h 
    #umount sdb1 
    #mount -a
    NFS : Server Setup Centos 6
    #yum install nfs-utils nfs-utils-lib -y 
    #chkconfig nfs on 
    #service nfs start 
    #cd /var; mkdir share 
    #chmod 755 share 
    #man exports 
    #vim /etc/exports
        /home    192.168.65.0/24(rw,no_root_squash) 
        /var/share    192.168.65.0/24(ro)
    #exportfs -a 
    #service nfs start
    NFS : Client Setup 
    Server#cat /etc/exports
    Client#yum install -y nfs-utils nfs-utils-lib
    Client#cd /mnt; mkdir nfs_home; mkdir nfs_share; ll 
    Client#mount 192.168.65.100:/home /mnt/nfs_home
    Client#mount 192.168.65.100:/var/share /mnt/nfs_share
    Client#df -h
    Client#ssh root@192.168.65.100 
    Server#cd /var/share; ll 
    Server#echo "Test" > test.txt 
    Client#cd /mnt/nfs_share; ll  
    Client#cat test.txt
    Client#cd /home; ll 
    Server#cd ../nfs_home; ll
    Client#vim /etc/fstab 
                192.168.65.100:/home    /mnt/nfs_home    nfs    rw,sync,hard,intr 0 0 
    Client#192.168.65.100:/var/share /mnt/nfs_share     nfs     rw,sync,hard,intr 0 0 
    Client#df -h 
    Client#cd ..; umount nfs_home; umount nfs_share 
    Client#df -h 
    Client#mount -a -> termount semuanya yang 192.168.x.x 
    Client#umount nfs_home
    Client#mount nfs_home
    
    

    
    SCP (Secure Copy Protocol)
    User1#mkdir transfer; mkdir receive
    User2#mkdir transfer; mkdir receive
    User1#whoami
    User1#cd /transfer; echo "Hello" > test.txt 
    User2#echo "Hello2" > test2.txt 
    User1#scp -v /home/user1/test.txt user2@192.168.1.3:/home/user2/receive
    User2#cd /receive; ll -> File sudah tercopy 
    User2#scp user1@192.168.1.2:/home/user2/transfer/test2.txt ~/receive
    SFTP (Secure FTP)
    User1#cd /ssh; vim sshd_config 
            Subsystem sftp /usr/lib/openssh/sftp-server 
    User1#cd /receive; ll
    User1#sftp user2@192.168.1.3
          sftp > pwd 
          sftp > ls -al 
          sftp > cd ..
          sftp > pwd 
          sftp > get fileyangakandiambil.txt target.txt 
          sftp > ldc ../transfer -> local change directory
          sftp > get fileyangakandiambilBaru.txt targetBaru.txt 
          sftp > ll; ls -al
    Createrepo Centos
    #cd /etc/yum.repos.d/; ll  
    #yum update 
    #yum info subversion 
    #yum install httpd
    #mkdir -p /var/www/html/repos/centos/6/7/
    #cd /var/www/html/repos/centos/6/7; ll
    #systemctl enable httpd
    #cd /etc/httpd/conf
    #vim httpd.conf 
        search /var
    #systemctl restart httpd 
    #ifconfig 
    #lynx httpd://localhost 
    #cd /var/www/html; ll 
    #vim index.html 
        Local Network Repo 
        Browse to 192.168.1.3/repos/centos/6/7/
    
    #yum install createrepo -> Local Repo 
    #cd /var/www/html; ll -> index.html & repos 
    #man createrepo
    #cd /var/www/html; createrepo /var/www/html/repos/centos/6/7
        
    Buka Browser -> https://www.centos.org/download/mirrors
    
    #rsync -avz rsync://centos.biz.net.id/centos/6.7/os/x86_64/ 
    /var/www/html/repos/centos/6/7
    
    Buka Browser -> http://centos.biz.net.id/
    
    #cd /repos/centos/6/7/; ll 
    #du -sch /var/www/html/repos/centos/6/7/* -> 5.9 GB 
    #createrepo --update /var/www/html/repos/centos/6/7/ -> generating sqlite DBs
    
    Buka Browser 192.168.1.3/repos/centos/6/7/
    From Client
    #cat /etc/issue
    #yum update 
    #cd /etc/yum.repos.d; ll 
    #ls -al /root/repo_backup/ 
    #cat /root/repo_backup//epel.repo 
    #vim repolokal.repo
        [myrepo]
        name=Repo Centos Local 
        baseurl=http://192.168.1.3/repos/centos/6/7/
        gpgcheck=1 
        gpgkey=http://mirror.centos.org/centos/RPM-GPG=key-CentOS-6
    #ping 192.168.1.3
    #yum update 
    #yum info subversion -> harus sudah berubah ke lokal repository
    #yum install subversion
    
    #rm repolokal.repo
    #mv root/repo_backup/*.repo . 
    #yum update -> masih bisa syncronize
    Repo Ubuntu 14.04 LTS
    #apt-get update 
    #apt-get install apt-mirror proftpd-basic -> standalone install
    #ps aux | grep ftp
    #ftp localhost -> Bisa Login 
    
    Buka Browser ke https://launchpad.net/ubuntu/+archivemirrors
    
    #cd /etc/apt; ll 
    #vim mirror.list 
        set base_path /opt/dist-mirror
        #Where I am mirroring from 
    #cd /opt/dist-mirror;ll 
    #apt-mirror -> download dengan thread yang sudah disetting, semakin besar 
    semakin cepat
    #du -sch mirror/* 
     du -h 
    #cd /opt/dist-mirror; 
    #mount --bind /opt/dist-mirror/mirror.mirror.lstn.net/ /srv/ftp/
    #mount 
    #vim /etc/rc.local 
        #mount the ftp bind ke apt-mirro -> comment
         mount --bind /opt/dist-mirror/mirror/mirror.lstn.net/ /srv/ftp/
    #crontab -e 
        0 1 * * * /usr/bin/apt-mirror >> /home/yudha/mirror.log
    Client Ubuntu 
    #cd /opt/dist-mirror/mirror/mirror.lstn.net; ll 
    #cd /etc/apt; ll 
    #vim sources.list 
        ## Repo Lokal 
           deb ftp://192.168.1.2/ubuntu trusty main 
           deb-scr ftp://192.168.1.2/ubuntu trusty main 
    #apt-get update -> belum bisa karena arch processornya 
    #uname -a     
    #vim sources.list 
           deb [arch=amd64] ftp://192.168.1.2/ubuntu trusty main 
           deb-scr [arch=amd64] ftp://192.168.1.2/ubuntu trusty main 
    #apt-get update -> Sudah bisa 
    #apt-get install subversion

     

 

Author:

Teman yang baik, teman yang memaksa anda untuk terus berkembang...

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s