Tuesday, November 27, 2012

Thursday, November 22, 2012

Install apache,mysql,php (LAMP) on Centos 6/Scientific Linux 6

sudo yum install httpd

sudo service httpd start

sudo chkconfig httpd on

find your ip address by

ifconfig eth0 | grep inet | awk '{ print $2 }'

To check if Apache is installed, direct your browser to your server’s IP address (for example http://192.168.0.2). The page should display the words “It works!"

sudo yum install mysql-server

sudo service mysqld start

set mysql root pasword by

sudo /usr/bin/mysql_secure_installation

sudo chkconfig mysqld on

sudo yum install php php-mysql

search php modules by

yum search php-

install the module by

sudo yum install name of the module

to know more about this module

yum info name of the module

Test your webserver

sudo nano /var/www/html/info.php

write

phpinfo();
?>

save and exit

sudo service httpd restart

http://localhost/info.php

Monday, November 19, 2012

Make a service available to a particular or multiple runlevels



chkconfig --level 2345 iptables on 


This will make the service iptables available on runlevel 2,3,4,5.

Checking to see a service is available or not to which runlevels


chkconfig --list iptables

the output is

iptables        0:off   1:off   2:on    3:on    4:on    5:on    6:off

So the iptables service is available in runlevel 2,3,4,5.

Friday, November 16, 2012

Configure basic NAT using iptables in Centos 5

If you are running a recent 2.6 Linux Kernel this four step process should work for you. This has been specifically tested on Fedora Core 3, 4, 5, and 6, but should work on any modern Linux distribution. All of these commands must be executed as the root user. First you need to tell your kernel that you want to allow IP forwarding.
echo 1 > /proc/sys/net/ipv4/ip_forward

Then you'll need to configure iptables to forward the packets from your internal network, on /dev/eth1, to your external network on /dev/eth0. You do this will the following commands:

# /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# /sbin/iptables -A FORWARD -i eth0 -o eth1 -m state
--state RELATED,ESTABLISHED -j ACCEPT
# /sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

You should now be NATing. You can test this by pinging an external address from one of your internal hosts. The last step is to ensure that this setup survives over a reboot. Obviously you should only do these last two steps if your test is a success.

You will need to edit /etc/sysctl.conf and change the line that says net.ipv4.ip_forward = 0 to net.ipv4.ip_forward = 1. Notice how this is similar to step number one? This essentially tells your kernel to do step one on boot. Ok last step for Fedora/RHEL users. In order for your system to save the iptables rules we setup in step two you have to configure iptables correctly. You will need to edit /etc/sysconfig/iptables-config and make sure IPTABLES_MODULES_UNLOAD, IPTABLES_SAVE_ON_STOP, and IPTABLES_SAVE_ON_RESTART are all set to 'yes'.

For non-Fedora/RHEL users you can simply setup an init script for this or simply append these commands to the existing rc.local script so they are executed on boot. Or if you want to get even more fancy, you can use the commands iptables-save and iptables-restore to save/restore the current state of your iptables rules.


source:http://www.revsys.com/writings/quicktips/nat.html

Wednesday, November 14, 2012

200 port command successful consider using pasv solved



Very irritating,I used mget rather than get and it worked just fine.

mget filename/foldername

Vsftp error “500 OOPS: cannot change directory:/some/directory solved

yum install vsftpd

then start it by 


service vsftpd start

verify it's opened port(whether it's 21) by

netstat -tulpn | grep :21


go to system-> administration-> firewall and check the ftp

the firewall will be started and it will open the 21 port

Now the famous error "Vsftp error “500 OOPS: cannot change directory:/some/directory"

you can not log in with any local user

to solve it

[root@sun02 vsftpd]# getenforce


Enforcing


[root@sun02 vsftpd]# getsebool -a | grep ftp


allow_ftpd_anon_write –> off
allow_ftpd_full_access –> off
allow_ftpd_use_cifs –> off
allow_ftpd_use_nfs –> off
allow_tftp_anon_write –> off
ftp_home_dir –> on (change that to on in ur case this option is off)
ftpd_disable_trans –> off
ftpd_is_daemon –> on
httpd_enable_ftp_server –> off
tftpd_disable_trans –> off


[root@sun02 vsftpd]# setsebool -P ftp_home_dir on


setsebool command may not be found,it is in the /usr/sbin folder,create a softlink to /usr/bin

and you are done,restart vsftpd,the last command took a little time,that's all

source:http://blog.arithm.com/2009/06/15/defeating-vsftp-error-500-oops-cannot-change-directorysomedirectory/

Some irritating things solved when trying to compile c++ and java on Scientific Linux 6



Installed openjdk,java command working but javac command not found error

solved by

sudo yum install java-1.6.0-openjdk-devel

gcc installed but g++ command not found error

solved by

yum install gcc-c++

compiling a cpp file with g++ works find but code blocks shows an error with a return code from the gnome terminal 255

Solved by

yum install xterm

now run codeblocks from the terminal or application->programming-codeblocks

hope those works on Cent os or Fedora too

Sunday, November 11, 2012