Guidance with CentOS 7 startup basics

I have been charged with the responsibility of rolling out a few Centos 7 based webservers based on the bitnami wordpress stack. I have everything working well expect for the following items I am stuck on.

1. How do I make it so the apache and mySQL services run at startup? If i run this command by hand it works until the next reboot.

$ ./ctlscript.sh start

2. How do I open up web traffic (port 80) using firewallld.

I am familiar with doing this with CentOS 6 using iptables and init.d but this new version is very different. Any guidance is appreciated.
LVL 2
ubixtechAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gheistCommented:
1) nothing changed:
chkconfig httpd on
chkconfig mysqld on
2) i dont know about firewalld, probrbly it has to be edited in xml files in /etc/firewalld
you can install system-config-firewall and uninstall firewalld and work like on RHEL6 (at least I did so)
0
Zephyr ICTCloud ArchitectCommented:
1) The "systemd-way" way of enabling a service to start at next reboot is like this:

systemctl enable apache2.service

2) Firewalld isn't that difficult
- First try to determine your default zone:
firewall-cmd --get-default-zone
- Make sure the zone that is default is the one you'd like use, otherwise change it (e.g dmz, trusted):
firewall-cmd --set-default-zone=zonename
(you might also be best off if you set the zone in your network-file as well "ZONE=dmz" for example)
- To set the port for http:
firewall-cmd --zone=dmz --add-service=http --permanent (use permanent to keep the setting)
- After configuring all, reload the firewall:
firewall-cmd --complete-reload

More info: man firewall-cmd ;-)

If you get stuck, let us know.
0
pxhCommented:
1) as spravtek said, use "systemctl" , if you use chkconfig as gheist says, CentOS 7 tells you what commands it is using instead.

2) You can continue using iptables.

So systemctl stop firewalld / systemctl disable firewalld and then systemctl enable iptables / systemctl start iptables, before that you should put your iptables config into /etc/sysconfig/iptables
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

gheistCommented:
1) it prints commands both ways. There are still some services that are old type and systemctl shows chkconfig command
2) you can use system-config-network like in EL6
0
ubixtechAuthor Commented:
Thanks for all the replies.

(Worked) chkconfig httpd on
(Did not work) chkconfig mysqld on

However they did not persist upon reboot. I am assuming since this is a lamp stack and the software isnt technically installed as a service.

I think my solution to this is to simple have the command
"./opt/wordpress/ctlscript.sh start"
Launch at system startup. What is the best way to approach this with CentOS 7?
0
gheistCommented:
Sorry we wera assuming that you installed LAMP stack using centos packages.
No idea what you got on your disk, but anything your package left in /etc/init.d/ should be chkconfig-ed on
And once enabled service starts at every boot.
0
Aman SubhanOracle Database AdministratorCommented:
You can place your startup script in /etc/rc.local as this will run after all scripts completes their startup sequence

Just add your line in the end:
sh /opt/wordpress/ctlscript.sh start

Open in new window


This will hopefully start your services as a part of server startup :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ubixtechAuthor Commented:
Thanks for the assistance. I was able to modify the start-up script and get things rolling. All of your suggestions helped me achieve a resolution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.