Install PHP 5.2.17 on CentOS 5.10

CentOSAnother server came with specific hardware that require me to install CentOS 5.10 64 bit with base only package. Since CentOS 5 use PHP 5.1 by default so I decide to find a way for PHP 5.2.17 (latest version of PHP 5.2 generation).

 

I use Jason package from jasonlitka.com

# nano /etc/yum.repos.d/utter-ramblings.repo
fill these lines :

[utter-ramblings]
name=Utter Ramblings
baseurl=http://yum.jasonlitka.com/EL5/x86_64/
gpgkey=http://yum.jasonlitka.com/RPM-GPG-KEY-jlitka
enabled=1
gpgcheck=1

save.

Make sure to change to http://yum.jasonlitka.com/EL5/i386/ for baseurl if you use 32 bit.

Install PHP and friends

PHP 5.2.17

# yum install php php-mysql

MySQL

# yum install mysql-server

Run as service

# chkconfig httpd --add
# chkconfig  httpd  on --level 235
# chkconfig  mysqld --add
# chkconfig mysqld on --level 235

2  =  Multi-user mode console logins only (without networking)
3  =  Multi-User mode, console logins only
5  = Multi-User mode, with display manager as well as console logins (X11)

Checking if already set as service

# chkconfig --list mysqld
mysqld             0:off    1:off    2:on    3:on    4:off    5:on    6:off
# chkconfig --list httpd
httpd              0:off    1:off    2:on    3:on    4:off    5:on    6:off

Checking installed httpd and mysql :

# rpm -qa | grep httpd
httpd-2.2.22-jason.1

# rpm -qa | grep mysql
mysql-server-5.1.58-jason.1
mysql-5.1.58-jason.1
php-mysql-5.2.17-jason.2
mysqlclient15-5.0.91-1.jason.1

Reboot.

P.S : in case you got error (refused connection) then iptables need to told about this service :

# iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
# service iptables save

Saving firewall rules to /etc/sysconfig/iptables:          [  OK  ]
# service iptables restart
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
Applying iptables firewall rules:                          [  OK  ]
Loading additional iptables modules: ip_conntrack_netbios_n[  OK  ]

Update

Last check : date

# date
Rab Nov 12 18:20:19 WIT 2014

Checking BIOS time I see no error.

# rpm -qa | grep ntp

Since another process lock yum, I use quick way :

# date 111210212014
Rab Nov 12 10:21:00 WIT 2014

Yes, that command use following format

date MMDDhhmmYYYY

MM -> month (in two digit)

DD -> date (in two digit)

hh -> hour (in 24 hour format)

mm -> minutes (in 2 digit)

YYYY -> year (in 4 digit)

Check again after issue command.

# date

Rab Nov 12 10:25:21 WIT 2014

Yes, the result is match.

I’ll continue with ntp next time.

For quick dns setting I use maradns.

Update January 15 2015 :

I need fail2ban for this server :

Add server

#rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
warning: /var/tmp/rpm-xfer.UKJ53A: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing… ########################################### [100%]
1:epel-release ########################################### [100%]

Install fail2ban

# yum install fail2ban
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: centos.biz.net.id
* epel: buaya.klas.or.id
* extras: centos.biz.net.id
* updates: centos.biz.net.id
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package fail2ban.noarch 0:0.8.14-1.el5 set to be updated
–> Processing Dependency: python-inotify for package: fail2ban
–> Running transaction check
—> Package python-inotify.noarch 0:0.9.1-1.el5 set to be updated
–> Processing Dependency: python-ctypes for package: python-inotify
–> Running transaction check
—> Package python-ctypes.x86_64 0:1.0.2-3.el5 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
fail2ban noarch 0.8.14-1.el5 epel 266 k
Installing for dependencies:
python-ctypes x86_64 1.0.2-3.el5 base 210 k
python-inotify noarch 0.9.1-1.el5 epel 86 k

Transaction Summary
========================================================================================================================================================================
Install 3 Package(s)
Upgrade 0 Package(s)

Total download size: 562 k
Is this ok [y/N]: y
Downloading Packages:
http://buaya.klas.or.id/epel/5/x86_64/python-inotify-0.9.1-1.el5.noarch.rpm: [Errno 12] Timeout: <urlopen error timed out>
Trying other mirror.
(1/3): python-inotify-0.9.1-1.el5.noarch.rpm | 86 kB 00:00
(2/3): python-ctypes-1.0.2-3.el5.x86_64.rpm | 210 kB 00:03
(3/3): fail2ban-0.8.14-1.el5.noarch.rpm | 266 kB 00:02
————————————————————————————————————————————————————————
Total 6.8 kB/s | 562 kB 01:22
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 217521f6
epel/gpgkey | 1.7 kB 00:00
Importing GPG key 0x217521F6 “Fedora EPEL <epel@fedoraproject.org>” from /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : python-ctypes 1/3
Installing : python-inotify 2/3
Installing : fail2ban 3/3

Installed:
fail2ban.noarch 0:0.8.14-1.el5

Dependency Installed:
python-ctypes.x86_64 0:1.0.2-3.el5 python-inotify.noarch 0:0.9.1-1.el5

Complete!

Configuration fail2ban

# nano /etc/fail2ban/jail.conf

Pay attention to ssh section

service fail2ban restart

# service fail2ban restart
Stopping fail2ban: ERROR Unable to contact server. Is it running?
[FAILED]
Starting fail2ban: [ OK ]

Check fail2ban exist?

# ps ax | grep fail
4066 ? Sl 0:00 /usr/bin/python /usr/bin/fail2ban-server -b -s /var/run/fail2ban/fail2ban.sock -p /var/run/fail2ban/fail2ban.pid -x
4099 ? S 0:00 sh -c printf %b “Subject: [Fail2Ban] SSH: stopped on `uname -n`?Date: `LC_TIME=C date -u +”%a, %d %h %Y %T +0000″`?From: Fail2Ban <fail2ban@example.com>?To: you@example.com\n?Hi,\n?The jail SSH has been stopped.\n?Regards,\n?Fail2Ban” | /usr/sbin/sendmail -f fail2ban@example.com you@example.com
4103 ? S 0:00 /usr/sbin/sendmail -f fail2ban@example.com you@example.com
4173 ? Sl 0:00 /usr/bin/python /usr/bin/fail2ban-server -b -s /var/run/fail2ban/fail2ban.sock -p /var/run/fail2ban/fail2ban.pid -x
4184 ? S 0:00 sh -c printf %b “Subject: [Fail2Ban] SSH: started on `uname -n`?Date: `LC_TIME=C date -u +”%a, %d %h %Y %T +0000″`?From: Fail2Ban <fail2ban@example.com>?To: you@example.com\n?Hi,\n?The jail SSH has been started successfully.\n?Regards,\n?Fail2Ban” | /usr/sbin/sendmail -f fail2ban@example.com you@example.com
4188 ? S 0:00 /usr/sbin/sendmail -f fail2ban@example.com you@example.com

Update : June 24 2015

I just know ntsysv, an utility that useful to enable the service during boot. Neat one.

Well, I need to set sender address :-)

Install Lua on Linux Ubuntu

As Android world use Java mostly for its language then I found Lua is another language that powering many games. I want to try it on my Ubuntu desktop and see how it goes :

$ sudo apt-get install lua
[sudo] password for alamsyah:
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package lua is a virtual package provided by:
lua50 5.0.3-6
lua5.2 5.2.1-3
lua5.1 5.1.5-4
You should explicitly select one to install.

I choose Lua 5.2
$ sudo apt-get install lua5.2
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
libjavascriptcoregtk-1.0-0 libwebkitgtk-1.0-0 libwebkitgtk-1.0-common
Use ‘apt-get autoremove’ to remove them.
The following NEW packages will be installed:
lua5.2
0 upgraded, 1 newly installed, 0 to remove and 341 not upgraded.
Need to get 159 kB of archives.
After this operation, 357 kB of additional disk space will be used.
Get:1 http://id.archive.ubuntu.com/ubuntu/ raring/universe lua5.2 i386 5.2.1-3 [159 kB]
Fetched 159 kB in 2s (57,1 kB/s)
Selecting previously unselected package lua5.2.
(Reading database … 200688 files and directories currently installed.)
Unpacking lua5.2 (from …/lua5.2_5.2.1-3_i386.deb) …
Processing triggers for man-db …
Setting up lua5.2 (5.2.1-3) …
update-alternatives: using /usr/bin/lua5.2 to provide /usr/bin/lua (lua-interpreter) in auto mode
update-alternatives: using /usr/bin/luac5.2 to provide /usr/bin/luac (lua-compiler) in auto mode

$

Checking version :
$ lua -v
Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio

$ luac -v
Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio

Nice, ready for the ‘moon’.

Trying Eclipse on Ubuntu 13.04

I want to try Eclipse on my Ubuntu 13.04 . Installation process is quite straight perhaps useful for me in future use.

Checking Java

I already install Java before, check it first :

$ java -version

java version “1.7.0_25”
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.13.04.2)
OpenJDK Server VM (build 23.7-b01, mixed mode)

Get nearest mirror from Eclipse website

As I’m from Indonesia I got mirror from University of Indonesia.

$ wget -c http://kambing.ui.ac.id/eclipse/technology/epp/downloads/release/kepler/SR1/eclipse-standard-kepler-SR1-linux-gtk.tar.gz

Checking md5 sum against :

bd98e1ac83cbc95909a3c856d3ced8a6  eclipse-standard-kepler-SR1-linux-gtk.tar.gz

$ md5sum eclipse-standard-kepler-SR1-linux-gtk.tar.gz
bd98e1ac83cbc95909a3c856d3ced8a6  eclipse-standard-kepler-SR1-linux-gtk.tar.gz

Good packet.

$ tar xvzf eclipse-standard-kepler-SR1-linux-gtk.tar.gz

$ sudo ln -s /home/alamsyah/eclipse/eclipse /usr/bin/eclipse
[sudo] password for alamsyah:
$

Launcher

$ sudo nano /usr/share/applications/eclipse.desktop

[Desktop Entry]
Version=4.3.1
Name=Eclipse
Comment=IDE for all seasons
Exec=env UBUNTU_MENUPROXY=0 /home/alamsyah/elipse/eclipse
Icon=/home/alamsyah/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=Utility;Application;Development;IDE

Done.

Add ADT Plugin

Start eclipse by typing : eclipse . Click Help and Install New Software.

Click Add button and enter :

Name : ADT

Url : https://dl-ssl.google.com/android/eclipse/

Next.

install_devel_android_eclipse

Click Next.

addroid_eclipse2

Accept Terms.

android_eclipse3

Choose ‘Always run in background’.

android_eclipse4

 

How to install FreeBSD 10 step by step

Horray, FreeBSD 10 is out and ready to serve as usual :-) .  After getting iso file for i386 I quickly set Virtualbox using memory 512MB and space 20GB plus setting ethernet as Bridge. Fire up start button bring me to installation screen. Major release always excite me and I try to document installation process in case others need it.

Lets get start :

By default Virtualbox will set iso file as first boot device and I get this screen.

install_freebsd10_1

Let the default option or wait for autobot. Press Space to pause and choose other option.

Continue reading

How to connect to OpenVPN server from Ubuntu 13.04 Desktop

Yesterday my friend came to my house and ask about connect to openvpn server from linux desktop. I told him to install vpn client first then connect to vpn server but that instruction is not enough for him so I give him personal assistance and document the process here in case someone need it in the future. Lets get start :

Install OpenVPN client

$ sudo apt-get install openvpn
[sudo] password for alamsyah:
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
libjavascriptcoregtk-1.0-0 libwebkitgtk-1.0-0 libwebkitgtk-1.0-common
Use ‘apt-get autoremove’ to remove them.
The following extra packages will be installed:
libpkcs11-helper1
The following NEW packages will be installed:
libpkcs11-helper1 openvpn
0 upgraded, 2 newly installed, 0 to remove and 330 not upgraded.
Need to get 494 kB of archives.
After this operation, 1.247 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://id.archive.ubuntu.com/ubuntu/ raring/main libpkcs11-helper1 i386 1.09-1build1 [47,6 kB]
Get:2 http://id.archive.ubuntu.com/ubuntu/ raring/main openvpn i386 2.2.1-8ubuntu3 [447 kB]
Fetched 494 kB in 8s (61,7 kB/s)
Preconfiguring packages …
Selecting previously unselected package libpkcs11-helper1:i386.
(Reading database … 200544 files and directories currently installed.)
Unpacking libpkcs11-helper1:i386 (from …/libpkcs11-helper1_1.09-1build1_i386.deb) …
Selecting previously unselected package openvpn.
Unpacking openvpn (from …/openvpn_2.2.1-8ubuntu3_i386.deb) …
Processing triggers for man-db …
Processing triggers for ureadahead …
ureadahead will be reprofiled on next reboot
Setting up libpkcs11-helper1:i386 (1.09-1build1) …
Setting up openvpn (2.2.1-8ubuntu3) …
* Restarting virtual private network daemon(s)…                                                                                               *   No VPN is running.
Processing triggers for libc-bin …
ldconfig deferred processing now taking place
Processing triggers for ureadahead …
$

Download openvpn client configuration file

Connection setting for specific user can be found easily if you use openvn as, just access the address in the following format :

http://servername:943

openvpn_client_ubuntu

Click on “Yourself (user-located profile)”.

Connect to OpenVPN server

Pick downloaded client.ovpn

$ sudo openvpn --config Downloads/client.ovpn
Sat Jan 18 14:18:15 2014 OpenVPN 2.2.1 i686-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Feb 13 2013
Enter Auth Username:alam
Enter Auth Password:
…………….
………………….
……………………..

Sat Jan 18 14:18:27 2014 TUN/TAP device tun0 opened
Sat Jan 18 14:18:27 2014 TUN/TAP TX queue length set to 100
Sat Jan 18 14:18:27 2014 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Sat Jan 18 14:18:27 2014 /sbin/ifconfig tun0 172.27.232.5 netmask 255.255.248.0 mtu 1500 broadcast 172.27.239.255
Sat Jan 18 14:18:32 2014 /sbin/route add -net 192.241.146.134 netmask 255.255.255.255 gw 192.168.1.1
Sat Jan 18 14:18:32 2014 /sbin/route add -net 0.0.0.0 netmask 128.0.0.0 gw 172.27.232.1
Sat Jan 18 14:18:32 2014 /sbin/route add -net 128.0.0.0 netmask 128.0.0.0 gw 172.27.232.1
Sat Jan 18 14:18:32 2014 Initialization Sequence Completed

if you want to hide all those message use –daemon

$ sudo openvpn --daemon --config Downloads/client.ovpn
Enter Auth Username:alam
Enter Auth Password:
$

Ip address before connection made

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 08:9e:01:1c:3a:f9
UP BROADCAST MULTICAST  MTU:1500  Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth1      Link encap:Ethernet  HWaddr 08:3e:8e:32:8f:62
inet addr:192.168.1.205  Bcast:192.168.1.255  Mask:255.255.255.0
inet6 addr: fe80::a3e:8eff:fe32:8f62/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:348892 errors:23 dropped:0 overruns:0 frame:253441
TX packets:267410 errors:25 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:438515703 (438.5 MB)  TX bytes:29792681 (29.7 MB)
Interrupt:19

lo        Link encap:Local Loopback
inet addr:127.0.0.1  Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING  MTU:65536  Metric:1
RX packets:4789 errors:0 dropped:0 overruns:0 frame:0
TX packets:4789 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:481600 (481.6 KB)  TX bytes:481600 (481.6 KB)
$

Ip address after connected :

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 08:9e:01:1c:3a:f9
UP BROADCAST MULTICAST  MTU:1500  Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth1      Link encap:Ethernet  HWaddr 08:3e:8e:32:8f:62
inet addr:192.168.1.205  Bcast:192.168.1.255  Mask:255.255.255.0
inet6 addr: fe80::a3e:8eff:fe32:8f62/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:349509 errors:24 dropped:0 overruns:0 frame:261386
TX packets:268163 errors:25 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:438599978 (438.5 MB)  TX bytes:29983493 (29.9 MB)
Interrupt:19

lo        Link encap:Local Loopback
inet addr:127.0.0.1  Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING  MTU:65536  Metric:1
RX packets:4829 errors:0 dropped:0 overruns:0 frame:0
TX packets:4829 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:484929 (484.9 KB)  TX bytes:484929 (484.9 KB)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:172.27.232.5  P-t-P:172.27.232.5  Mask:255.255.248.0
UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
RX packets:142 errors:0 dropped:0 overruns:0 frame:0
TX packets:240 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:13651 (13.6 KB)  TX bytes:53785 (53.7 KB)

Use service like whatismyip.com to check current ip address.