Sure! You don't say but if you're using Red Hat Server (probably CentOS) and probably versions 5 or 6, all you have to do is configure the 2 services httpd
and iptables
so that they either startup or shutoff when your server boots.
Service setup
There is a command line tool which you can use to do this configuration change, called chkconfig
.
$ chkconfig --level 345 httpd on
$ chkconfig iptables off
Leaving the firewall up
Rather than disable your firewall, I'd encourage you to simply leave it up and add a rule allowing the port 80 traffic in and out so that it can reach the Apache web server.
$ iptables -A INPUT -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
$ iptables -A OUTPUT -o eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
These rules should open up 80, assuming the Ethernet device your VM uses is eth0
. You might need to do some sleuthing to get this information, you can use the ip
command to confirm.
$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 54:52:00:ff:ff:dd brd ff:ff:ff:ff:ff:ff
Making the FW rules stick!
To make these iptables
rules permanent you can add them as I've described above and then tell iptables
to save them for next time.
$ /etc/init.d/iptables save