Install Aplikasi WebServer dan DatabaseServer di CentOs



Dalam tutorial kali ini saya akan mambahas bagaimana cara membangun aplikasi dasar webserver di CentOs.

Berikut langkah-langkahnya :

1. Install Mysql

# yum install mysql mysql-server

Kemudian buat Mysql Otomatis hidup saat statrtup dengan perintah berikut :

# chkconfig --levels 235 mysqld on# service mysqld start

Lalu set Password untuk akun root Mysql :

# mysql_secure_installation

[root@server1 trio]# mysql_secure_installation

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):
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] <-- ENTER
New password: <-- Masukkan password untukuserroot Mysql
Re-enter new password: <-- Password root Mysql di masukkan ulang lagi
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] <-- 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] <-- 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] <-- 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] <-- 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!


[root@server1 trio]#

2. Install dan Konfigurasi Httpd

# yum install httpd -y

Hapus welcome page

[root@server1 trio]# rm -f /etc/httpd/conf.d/welcome.conf

Hapus default dari error page

[root@server1 trio]# rm -f /var/www/error/noindex.html

Konfigurasi httpd

[root@server1 trio]# vi /etc/httpd/conf/httpd.conf

- Pada baris 44 ubah menjadi
ServerTokens  Prod

- Pada baris ke 76 ubah menjadi  On
KeepAlive  On

- Pada baris 262 ganti sesuai dengan Admin Address
ServerAdmin root@server1.smkwikrama.edu

- Pada baris ke 276 ubah sesuai dengan name server
ServerName www.server1.smkwikrama.edu:80

- Pada baris 338 ubah menjadi
AllowOverride All

- Pada Baris  536 ubah
ServerSignature Off

- Pada baris 759 tambahkan tanda pagar (#)di depannya  :
#AddDefaultCharset UTF-8

Jika sudah selesai konfigurasi lalu simpan, dan jalankan service httpd dan buat service httpd otomatis berjalan/autostartup.

[root@server1 trio]# service httpd start
[root@server1 trio]# chkconfig httpd on

Lalu buat file html atau masukkan file html untuk test page di /var/www/index.html

[root@server1 trio]# vi /var/www/html/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
SMK WIKRAMA 1 JEPARA
</div>
</body>
</html>

Setelah itu simpan dan test di browser.


3. Install PhpMyadmin
Karena pada tutorial sebelumnya saya sudah memberikan penjelasan dan menambahkan repositori untuk centos jadi kita bisa langsung menginstall aplikasinya , bagi yang belum tahu bagaimana cara menambahkan repo di CentOs klik disini .

[root@server1 trio]#  yum -y install phpmyAdmin php-mysql php-mcrypt
[root@server1 trio]# vi /etc/httpd/conf.d/phpMyAdmin.conf

- pada baris 14 tambahkan IP dari mana saja yang boleh mengakses 
Allow from 127.0.0.1 10.0.0.0/24 192.168.12.0/24

Untuk mengakses PhpMyadmin ketik saja di address bar browser http;//(ipaddressserver)/phpmyadmin

Sekian semoga bermanfaat, jika ada kritik dan saran silahkan tuangkan di kolom komentar .
Salam TKJ
Follow Me


EmoticonEmoticon