LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 03-31-2015, 05:54 AM   #1
masterross
Member
 
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107

Rep: Reputation: 17
Installing Apache, php, Mysql from source and systemd?


Hi,

Till now I used CentOS 6.x with SysV and there wasnt prob with services.
But in CentOS 7.x is used Systemd and I dont know how to setup services for Apache, php, Mysql installed from source.
Can you guide me plz?

Thx!
 
Old 03-31-2015, 08:40 PM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Why not install them via package management? systemd supports SysV scripts in /etc/init.d as well. Otherwise, see the man pages (man systemd) and look to the "See also" sections for references to other man pages and man page levels for further reading.
 
Old 04-01-2015, 01:23 AM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
use yum to install the software group

Code:
su -
yum grouplist 
---- then from that list it should be ----
yum groupinstall "web server"
 
Old 04-01-2015, 11:02 AM   #4
masterross
Member
 
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107

Original Poster
Rep: Reputation: 17
I dont want want to use versions of apps supplied by yum.
I want specific versions. Thats why I compiled from source but this systemd makes my crasy!
 
Old 04-01-2015, 12:49 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
then use slack or LFS
you are using CentOS ( aka RHEL) for a reason
it is DEAD STABLE and almost never crashes
it is very WELL tested and very stable AND DOSE NOT CRASH


have you read the redhat documentation
https://access.redhat.com/documentat...h_systemd.html

you will have to manually make the needed files

Last edited by John VV; 04-01-2015 at 01:05 PM.
 
Old 04-01-2015, 01:54 PM   #6
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Most server software nowadays comes with .service files for systemd, just copy them to /etc/systemd/system and enable them using systemctl. Alternatively, use the distribution provided .service files, you can extract them from the respective RPMs.
 
Old 04-01-2015, 02:55 PM   #7
masterross
Member
 
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107

Original Poster
Rep: Reputation: 17
Hi TobiSGD,

Thx for reply.
I've already did that.
I put tthe httpd.service and edited to point to binaries.
Enabled the service.
But I still cant start the service via systemctl
 
Old 04-02-2015, 08:32 AM   #8
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Which error messages do you get?
 
Old 04-02-2015, 10:07 AM   #9
masterross
Member
 
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107

Original Poster
Rep: Reputation: 17
CentOS 7 - httpd and systemd problem!

Hi guys.

I have problems with Apache v2.2.29 build from source and systemd.
My /usr/lib/systemd/system/httpd.service

Quote:
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/apache2/logs/httpd.pid
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/local/apache2/bin/apachectl start
ExecStop=/usr/local/apache2/bin/apachectl graceful-stop
ExecReload=/usr/local/apache2/bin/apachectl graceful

# We want systemd to give httpd some time to finish gracefully, but still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
# httpd time to finish.
KillSignal=SIGCONT
PrivateTmp=true

[Install]
WantedBy=multi-user.target
I can start it via systemctl stop httpd.service
But the web server is not available trough internet.

systemctl status httpd.service gives:

Quote:
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
Active: active (running) since Thu 2015-04-02 17:53:04 EEST; 1min 45s ago
Process: 18354 ExecStop=/usr/local/apache2/bin/apachectl graceful-stop (code=exited, status=0/SUCCESS)
Process: 18398 ExecStart=/usr/local/apache2/bin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 18401 (httpd)
CGroup: /system.slice/httpd.service
18401 /usr/local/apache2/bin/httpd -k start
18402 /usr/local/apache2/bin/httpd -k start
18403 /usr/local/apache2/bin/httpd -k start
18404 /usr/local/apache2/bin/httpd -k start
18405 /usr/local/apache2/bin/httpd -k start
18406 /usr/local/apache2/bin/httpd -k start
18407 /usr/local/apache2/bin/httpd -k start
18408 /usr/local/apache2/bin/httpd -k start
18409 /usr/local/apache2/bin/httpd -k start
18410 /usr/local/apache2/bin/httpd -k start
18411 /usr/local/apache2/bin/httpd -k start
18412 /usr/local/apache2/bin/httpd -k start
18413 /usr/local/apache2/bin/httpd -k start
18414 /usr/local/apache2/bin/httpd -k start
18415 /usr/local/apache2/bin/httpd -k start
18416 /usr/local/apache2/bin/httpd -k start
18417 /usr/local/apache2/bin/httpd -k start
18418 /usr/local/apache2/bin/httpd -k start
18419 /usr/local/apache2/bin/httpd -k start
18420 /usr/local/apache2/bin/httpd -k start
18421 /usr/local/apache2/bin/httpd -k start
18422 /usr/local/apache2/bin/httpd -k start
18423 /usr/local/apache2/bin/httpd -k start
18424 /usr/local/apache2/bin/httpd -k start
18425 /usr/local/apache2/bin/httpd -k start
18426 /usr/local/apache2/bin/httpd -k start
18459 /usr/local/apache2/bin/httpd -k start
18460 /usr/local/apache2/bin/httpd -k start
18461 /usr/local/apache2/bin/httpd -k start
18462 /usr/local/apache2/bin/httpd -k start
18463 /usr/local/apache2/bin/httpd -k start
18464 /usr/local/apache2/bin/httpd -k start
18467 /usr/local/apache2/bin/httpd -k start
18468 /usr/local/apache2/bin/httpd -k start
18471 /usr/local/apache2/bin/httpd -k start
18472 /usr/local/apache2/bin/httpd -k start
18473 /usr/local/apache2/bin/httpd -k start
18476 /usr/local/apache2/bin/httpd -k start
18477 /usr/local/apache2/bin/httpd -k start
18478 /usr/local/apache2/bin/httpd -k start
18479 /usr/local/apache2/bin/httpd -k start

Apr 02 17:53:04 m018 systemd[1]: PID file /usr/local/apache2/logs/httpd.pid not readable (yet?) after start.
Apr 02 17:53:04 m018 systemd[1]: Started The Apache HTTP Server.
Is it possible the service cant read httpd.conf?
And where should be set the path to httpd.conf?
Couse if I start it with:
/usr/local/apache2/bin/apachectl start

Apache starts w/o problem and all is OK.

Waiting for your hints guys.

Edit1:
Actually the web is working but cant connect to mysql when is started with systemctl
Mysql is again build from source
Still investigating...

Edit2:
Just saw in phpinfo (when started with systemctl) that a lot things missing from Environment section.

Last edited by masterross; 04-02-2015 at 12:15 PM.
 
Old 04-02-2015, 10:13 AM   #10
masterross
Member
 
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107

Original Poster
Rep: Reputation: 17
Hi

I have little progress after reading about 200 pages but still have probs.
Thats why I made a new thread in CentOS forum:
http://www.linuxquestions.org/questi...em-4175538543/
 
Old 04-02-2015, 01:41 PM   #11
kmhuntly
Member
 
Registered: Mar 2015
Location: Cheektowaga, NY
Distribution: ArchLinux
Posts: 34

Rep: Reputation: 7
Systemd runs as root so its likely able to read the apache configuration fine. Is the pidfile directive in the service configuration the same as in httpd configuration?

For MySQL, what errors are seen? Are you able to connect to the DB on the command line from the same system?
 
Old 04-02-2015, 02:41 PM   #12
masterross
Member
 
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107

Original Poster
Rep: Reputation: 17
Hi mate,

I'm not sure why it gives warning about pidfile but httpd start/reboot/stop ok with systemd.
Now the problem with mysql still exist.
When httpd is ran via systemd I see environment that mysql missing from the PATH:
Quote:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
And when stared directly via /usr/local/apache2/bin/apachectl mysql exist in the env PATH:
Quote:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/mysql/bin:/root/bin
So I guess path to mysql binaries should be added somewhere?

Thx!

Last edited by masterross; 04-02-2015 at 02:52 PM.
 
Old 04-03-2015, 04:12 AM   #13
masterross
Member
 
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107

Original Poster
Rep: Reputation: 17
I tried add export PATH=$PATH:/usr/local/mysql/bin
to
/usr/lib/systemd/system/httpd.service

But still I'm getting:
Connection failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Quote:
mysql> show variables like 'socket%';
+---------------+-----------------+
| Variable_name | Value |
+---------------+-----------------+
| socket | /tmp/mysql.sock |
+---------------+-----------------+
1 row in set (0.00 sec)

Last edited by masterross; 04-03-2015 at 04:30 AM.
 
Old 04-04-2015, 05:06 AM   #14
masterross
Member
 
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107

Original Poster
Rep: Reputation: 17
Anyone?
 
Old 04-05-2015, 11:16 AM   #15
kmhuntly
Member
 
Registered: Mar 2015
Location: Cheektowaga, NY
Distribution: ArchLinux
Posts: 34

Rep: Reputation: 7
Sorry I've been away sick... so very sick.

Couple things to check:

Is the socket actually in that location? Seems a little off to me, usually under /var/run/mysql

If it is there, is it readable by the user that runs Apache?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: An introduction to systemd for CentOS 7 LXer Syndicated Linux News 0 09-19-2014 01:01 AM
CentOS 5.3 - Too many httpd process sokha Linux - Server 7 03-12-2010 01:31 AM
httpd problem and caused my httpd to shut-down golpemortal Linux - Server 2 04-08-2007 03:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 03:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration