Sabtu, 04 Januari 2014

Installasi LAMP di linux centos

kali ini ane mau ngshare installasi LAMP
ya suatu program dasar untuk memulai membuat webserver
yang pertama kita harus tau dulu apa yang dimaksud LAMP itu
LAMP adalah (LINUX APACHE MYSQL PHP/PYHTON/PERL)
LINUX adalah operating system Apache adalah sebagai webserver
MYSQL adalah sebagai basis data
dan PHP adalah sebagai pemrograman yang dipakai oke langsung aja yang pertama kita mulai berurutan ok

LINUX pasti udah punya operating system ini kalo belom punya ga mungkin sampe ke post ini kecuali emang sengaja mau jalan" di blog ini :D next

APACHE pertama" masuk terminal dan ketikkan
[root@ubuntu ~]#yum install httpd -y
biarkan sampe proses installasi selesai
setelah selesai ketikkan
[root@ubuntu ~]#/etc/init.d/httpd start
langkah tersebut berfungsi untuk menjalankan service httpd
lalu ketikkan lagi
[root@ubuntu ~]#chkconfig httpd on
langkah tersebut untuk menjadikan httpd autorun atau otomatis berjalan ketika komputer di nyalakan
kemudian kita test dengan http://ipaddress contoh http://192.168.1.1 apa sudah bisa di lihat dengan gambar/tulisan index apache atau belom
kalo misalnya belom mungkin bisa pakai cara berikut
cek dulu SELINUX dan Firewall nya (disini sih biasanya yang sering saya temukan error) pada saat kita mau test apache nya.
cara nya dengan ;

[root@ubuntu ~]#vi /etc/selinux/config

lalu cukup merubah

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing – SELinux security policy is enforced.

# permissive – SELinux prints warnings instead of enforcing.

# disabled – No SELinux policy is loaded.

SELINUX= # dari enforcing menjadi disable#

# SELINUXTYPE= can take one of these two values:

# targeted – Targeted processes are protected,

# mls – Multi Level Security protection.

SELINUXTYPE=targeted

Lalu disable Firewall nya :

eiitt sebentar,biar lebih mudah nya menonaktifkan firewall kita bisa gunakan cara menginstall dlu konfigurasi firewall nya,

[root@ubuntu ~]#yum install system-config-securitylevel
[root@ubuntu ~]#system-config-firewall

Atau

[root@ubuntu ~]#system-config-firewall-tui


 nah skarang coba tes lagi dengan mengetikan ipaddress di browser
ok next

MYSQL
[root@ubuntu ~]#yum install mysql-server -y

Setelah penginstallan selesai lalu jalankan lagi perintah

[root@ubuntu ~]#/etc/init.d/mysqld start
[root@ubuntu ~]#chkconfig mysqld on

Perintah di atas adalah untuk menjalankan mysql secara otomatis setiap kali restart
Lalu kita setting password untuk Mysql nya dengan cara

[root@ubuntu ~]#/usr/bin/mysql_secure_installation

dan tampilan nya akan seperti ini ;

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):     ## Tekan Enter## 
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n]   Y  ## Tekan Enter ##
New password:                ## Password untuk Mysql ##
Re-enter new password:       ## ulangi password ##
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]   Y  ## Tekan Enter ##
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y    ## Tekan Enter ## 
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]Y     ## Tekan Enter ##
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y    ## Tekan Enter ##
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!
nah installasi MYSQL sukses,next yang terakhir


PHP
ketikkan perintah berikut
yum install php php-mysql -y
biarkan prosesnya selesai dan restart apachenya
/etc/init.d/httpd restart
berikutnya kita coba masukan data ke web kita
ketikkan perintah berikut
vi /var/www/html/phpinfo.php
/var/www/html adalah lokasi default directory web
jadi kalo mau masukin data ke website ya dari directory itu dulu

skarang masukkan kode php berikut
<?php
phpinfo();
?>
nah skarang restart apachenya dengan perintah berikut
/etc/init.d/httpd restart
dan lihat hasilnya di
http://ipaddress/phpinfo.php
contoh
http://192.168.1.1/phpinfo.php
terima kasih semoga bermanfaat :D

0 komentar:

Posting Komentar