You are on page 1of 14

Command Line to Configuring Services

in Linux Server

7
Server Services Layanan server yang akan kita bangun:

Connecting the network


DHCP Server

Remote Server
SSH

Transfer File
FTP and NFS

Build Application on Server


Web and Database

COMPUTER REPAIR & SUPPORT


DHCP
1. [root@localhost ~]# yum install dhcp
2. [root@localhost ~]# cd /etc/dhcp
3. [root@localhost dhcp]# cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.cadangan
4. [root@localhost dhcp]# vi dhcpd.conf
default-lease-time 60;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.1 192.168.1.10;
option broadcast-address 192.168.1.255
}
5. [root@localhost dhcp]# systemctl start dhcpd
6. [root@localhost dhcp]# systemctl enable dhcpd
7. [root@localhost dhcp]# systemctl status dhcpd
FTP
• [root@localhost ~]# yum install vsftpd
• [root@localhost ~]# firewall-cmd --zone=public --permanent
--add-port=21/tcp
• [root@localhost ~]# firewall-cmd --zone=public --permanent
--add-service=ftp
• [root@localhost ~]# firewall-cmd --reload
• [root@localhost ~]# systemctl start vsftpd
• [root@localhost ~]# systemctl enable vsftpd
NFS Samba
1. [root@localhost ~]# yum install samba samba-client samba-common -y
2. [root@localhost ~]# cd /etc/samba
3. [root@localhost samba]# cp /etc/samba/smb.conf /etc/samba/smb.conf.bkp
4. [root@localhost samba]# nano smb.conf
[global]
workgroup = WORKGROUP
server string = Samba Server
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
[Anonymous]
path = /etc/samba/anonymous
browsable = yes
writable = yes
guest ok = yes
read only = no
NFS Samba (2)
5. [root@localhost samba]# systemctl start smb.service dan nmb.service
6. [root@localhost samba]# systemctl enable smb.service dan nmb.service
7. [root@localhost samba]# firewall-cmd --zone=public --permanent
--add-service=samba
8. [root@localhost samba]# firewall-cmd --reload
9. [root@localhost samba]# mkdir anonymous
10. [root@localhost samba]# chmod 755 anonymous
11. [root@localhost samba]# chown nobody:nobody anonymous
12. [root@localhost samba]# chcon –t samba_share_t anonymous
13. [root@localhost samba]# systemctl restart smb
14. [root@localhost samba]# systemctl restart nmb
WEB + Database + PHP Server
• [root@localhost ~]# yum install httpd –y
• [root@localhost ~]# systemctl start httpd
• [root@localhost ~]# systemctl enable httpd
• [root@localhost ~]# yum install mariadb-server mariadb -y
• [root@localhost ~]# systemctl start mariadb
• [root@localhost ~]# systemctl enable mariadb
• [root@localhost ~]# yum install php php-mysql –y
• [root@localhost ~]# systemctl restart httpd
• [root@localhost ~]# echo "<?php phpinfo(); ?>" > /var/www/html/info.php
Membuka Koneksi Server
• [root@localhost ~]# firewall-cmd --zone=public --permanent
--add-service=http
• [root@localhost ~]# firewall-cmd --zone=public --permanent
--add-port=80/tcp
• [root@localhost ~]# firewall-cmd --reload
phpmyadmin
• [root@localhost ~]# yum install epel-release
• (Extra Packages for Enterprise Linux) berisi banyak paket tambahan, termasuk
phpmyadmin
• [root@localhost ~]# yum install phpmyadmin
• [root@localhost ~]# nano /etc/httpd/conf.d/phpMyAdmin.conf
. . .
Require ip [your_workstation_IP_address] Edit bagian script disamping
. . .
Allow from [your_workstation_IP_address] dengan mengubah IP
. . . 127.0.0.1 menjadi IP client
Require ip [your_workstation_IP_address]
. . . contoh: 192.168.1.1
Allow from [your_workstation_IP_address]
. . .

• [root@localhost ~]# systemctl restart httpd


Cara memasang password root mariadb
• [root@localhost ~]# systemctl status mariadb “pastikan active (running)”
• [root@localhost ~]# mysql_secure_installation
“kemudian masukkan password db” bila baru pertama kosongi kemudian klik Enter
“kemudian pilih y untuk memasang password baru” untuk pertanyaan selanjutnya
lewati saja dengan menekan tombol Enter
• [root@localhost ~]#
Mengaktifkan PHP
• [root@localhost ~]# yum install php php-mbstring php-pear -y
• [root@localhost ~]# nano /etc/php.ini

Cari baris " Time Zone " pada file tersebut yang berguna untuk mengatur
zona waktu, Lalu atur Time Zone nya menjadi " Asia/Jakarta ". Dan
hilangkan tanda " ; " pada baris tersebut agar script itu bisa berjalan.

• [root@localhost ~]# systemctl restart httpd


Mengaktifkan PHP
• [root@localhost ~]# yum install wget –y
• [root@localhost ~]# yum update –y
• [root@localhost ~]# reboot
• [root@localhost ~]# yum install vsftpd
• [root@localhost ~]# cd /usr/local/src
• [root@localhost src]# wget http://centos-webpanel.com/cwp-latest
• [root@localhost src]#sh cwp-latest (*dengan syarat tidak ada mysql “yum
remove mysql” kemudian install dan tunggu kurang lebih 20 menit bila
koneksi internet lancar)
Terima Kasih

You might also like