LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-05-2011, 03:06 AM   #1
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Rep: Reputation: 45
How to enable squid service ?


hi,
I have installed squid 2.6 in my cent os 5 machine. The installation location was
Code:
# ./configure@--prefix=/usr/local/squid
Normally with RPM base squid,to start and stop squid we use
# service squid start

# service squid stop

Now with source code based installation the start and stop services are not working. Kindly guide me that how can i do it?
thanks
garden
 
Old 04-05-2011, 03:23 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

At this site you can copy/paste a startup script for Squid (RedHat) which should work on your system too. Check the paths though.

Kind regards,

Eric
 
Old 04-05-2011, 05:26 AM   #3
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Original Poster
Rep: Reputation: 45
thanks EricTRA for the reply. Well is there any other option to do it.I does not have any idea about scripting language.
 
Old 04-05-2011, 05:51 AM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

If you want to start and stop Squid using a script in /etc/init.d you can just follow the steps as indicated in the link I pointed you to. No experience with scripting necessary. You just create the file, copy the text from that side and put it inside the file you created. Edit where necessary, for example they've changed the cache path so you might change that back to default. After that execute the commands as indicated on that site and you're set to go. If you indicate what part of the site you don't understand I'd be able to clarify.

Kind regards,

Eric
 
Old 04-05-2011, 03:44 PM   #5
Felipe
Member
 
Registered: Oct 2006
Posts: 302

Rep: Reputation: 32
hallo:

I don't know if there is any reason for downloading and compiling squid.

Else, you can use the squid included in the distribution, which is already compiled and which already includes the scripts for starting and stopping squid.

Regards
 
Old 04-06-2011, 12:38 AM   #6
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Original Poster
Rep: Reputation: 45
EricTRA well i have done the copy and past the script according to the method but i am confuse about the path.

Squid is in installed in the following path

[root@localhost squid-2.6.STATBLE22]# ls /usr/local/squid/etc/

The /usr/local/squid/var directory has the user nobody and group nobody


Code:
[root@localhost squid]#  ls -l   
total 38
drwxr-sr-x	2 root	root	4096	Mar	29     10:30	bin
drwxr-sr-x	2 root	root	4096	Mar	29     10:30	etc
drwxr-sr-x	2 root	root	4096	Mar	29     10:30	libexec
drwxr-sr-x	3 root	root	4096	Mar	29     10:30	man
drwxr-sr-x	2 root	root	4096	Mar	29     10:30	sbin
drwxr-sr-x	4 root	root	4096	Mar	29     10:30	share
drwxr-sr-x	3 nobody nobody	 4096	Mar	29     10:30	var
[root@localhost squid]#

The squid cache directory location is

Code:
[root@localhost ~ ]#  /usr/local/squid/sbin/squid -z

keeping in my the script which kindly just guide me the path where what should i do on it .
Be defauly when I all all settings and try to start it ,it does not show me that squid is not starting.Yes without any error it silently goes to prompt.

Code:
[root@localhost root]# /etc/rc.d/init.d/squid start
[root@localhost root]#
kindly guide me about the proper path in the script file according to my seeting and if you need some more path please let me know.

kinds regards
garden

Last edited by gardenair; 04-06-2011 at 12:45 AM.
 
Old 04-06-2011, 12:49 AM   #7
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by Felipe View Post
hallo:

I don't know if there is any reason for downloading and compiling squid.

Else, you can use the squid included in the distribution, which is already compiled and which already includes the scripts for starting and stopping squid.

Regards
Hi,

One main reason for compiling Squid is if you want to server HTTPS through Squid. The packages installed through package manager don't have that option enabled, thus forcing a user to compile from source. At least that was one reason I came across when I installed Squid version 3.0 almost a year ago. Don't know if their policy changed and if HTTPS is now included in the packages installed using package manager.

Kind regards,

Eric
 
Old 04-06-2011, 12:54 AM   #8
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Quote:
Originally Posted by gardenair View Post
The /usr/local/squid/var directory has the user nobody and group nobody
What's inside that directory, I assume only logs.
Quote:
Originally Posted by gardenair View Post
The squid cache directory location is

Code:
[root@localhost ~ ]#  /usr/local/squid/sbin/squid -z
No, that's the command to generate the cache structure, not the location. Have a look at your squid.conf to see where you've pointed your cache to.
Quote:
Originally Posted by gardenair View Post
Be defauly when I all all settings and try to start it ,it does not show me that squid is not starting.Yes without any error it silently goes to prompt.

Code:
[root@localhost root]# /etc/rc.d/init.d/squid start
[root@localhost root]#
I didn't 'analyze' the startup script I pointed you to. You can check if squid is running with either of the following:
Code:
service squid status
ps ax | grep squid
I'm not sure if the process is squid or squid3, last time I used it is almost a year ago. If the process starts silently, you could easily change the startup script to show a message. If you need help with that, just let us know.

Kind regards,

Eric
 
Old 04-06-2011, 01:26 AM   #9
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Original Poster
Rep: Reputation: 45
oh well sorry about the swap location .I wrongly write the command instead the path which is

Code:
/var/spool/squid
when i run the # service status squid is show

Code:
[root@localhost root]#service status squid
status: unrecognized service
Now when I run the script file

[root@localhost root]# /etc/rc.d/init.d/squid start
[root@localhost root]#

Now by ps aux
Code:
[root@localhost root]# ps aux | grep squid
root    3646   0.0  0.2  3532  552   pts/0     D    07:30  0:00  grep squid
I am sure in the script squid script (which I have copy and past) need to change the path

PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH

any guidance
regards
garden
 
Old 04-06-2011, 04:01 PM   #10
Felipe
Member
 
Registered: Oct 2006
Posts: 302

Rep: Reputation: 32
Sorry, but I use CentOS 5.5 and I've installed squid. I use https and https with client certificates and it works fine.
The version included in CentOS 5.5 is squid 2.6.STABLE 21.


About the command your are typing, the command is:
service squid status, not service status squid.

If your are not sure if your squid is well configured, try to run it as a program instead of a service.
If your are in the bin directory of squid, type
./squid --help
for watching the options.

If you type
./squid -N -X -d 1
you will see if it works fine as an application.


Regards
 
Old 04-07-2011, 01:13 AM   #11
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by Felipe View Post
Sorry, but I use CentOS 5.5 and I've installed squid. I use https and https with client certificates and it works fine.
The version included in CentOS 5.5 is squid 2.6.STABLE 21.
Hi Felipe,

I think you're commenting on my statement in post 7. I specified 'if you want to serve HTTPS'. With that I was referring to using Squid as reverse proxy to serve HTTPS content to the internet. In order to have that possibility I had to compile Squid 3.0 from source because the package installed by package manager didn't offer the HTTPS option. Sorry for being unclear.

Kind regards,

Eric
 
Old 04-07-2011, 01:19 AM   #12
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by gardenair View Post
I am sure in the script squid script (which I have copy and past) need to change the path
Code:
PATH=/usr/bin:/sbin:/bin:/usr/sbin
               export PATH
Hi,

In your original post you mentioned installing Squid in /usr/local/squid, but /usr nor /usr/local are included in your path statement inside the script. Check if Squid starts correctly when calling it directly as indicated by Felipe. If that works, then add the /usr/local directory to your path statement and try starting with the startup script.

Kind regards,

Eric
 
Old 04-07-2011, 05:51 AM   #13
Felipe
Member
 
Registered: Oct 2006
Posts: 302

Rep: Reputation: 32
Hallo:

For testing if squid.conf is configured right, try with:
squid -k check

As I told you, I use squid from CentoOS 5.5 (also tried in OpenSuse and RedHat) RPM for authentication (username/password, NTLM, user certificate- DNIe), authorization (user has to belong to groups of LDAP of Active Directory or fields of Database) an rewriter (add information of url extracted from LDAP and database), all in SQUID AS REVERSE PROXY.
For configuring squid as reverse proxy with https I've only had add (no exaclty this values):

https_port 443 accel defaultsite=server1.domain.com vhost vport=8081 cert=/data/cert/server.cer key=/data/cert/server.pem

With this, all request on port 443 are rewriten to server1.domain.com, port 8081.
Really, it's more complicated due to I use more servers and redirect urls to servers depending of url value.

Not sure if this can help you....

Regards
 
Old 04-08-2011, 02:18 AM   #14
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Original Poster
Rep: Reputation: 45
Well my squid is working normally and the client are connected with the squid proxy server. I am still confuse about the path

Code:
PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH
I does not know what is the purpose of this path and why the writer add it ? to run my squid I simply use the command
Code:
[root@localhost root]# /etc/rc.d/init.d/squid start


[root@localhost ~ ] # ps aux | grep squid  

root	17982  0.0  0.1  5252  1132  ?     Ss  14:11  0:00  /usr/localsquid/sbin/squid-D
nobody  17984  0.4 0.5 6912  4284  ?      S   14:11  0:00  (squid) –D
root	  17987   0.0  0.0  5040  664  pts/3  S+  14:12   0:00  grep squid
[root@localhost ~ ] #
Now to stop it what should I do ? Is it the proper way to start squid after installing from source code ?
Kindly guide me the way or the path which can work

thanks
 
Old 04-08-2011, 02:41 AM   #15
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

You can use the init script you use to start Squid also to stop/restart Squid:
Code:
/etc/rc.d/init.d/squid stop
/etc/rc.d/init.d/squid restart
You could also create the necessary links to start Squid automatically on boot by using the chkconfig command. Look at the man page:
Code:
man chkconfig
After you've done that you can also use the service command (less typing):
Code:
service squid start|stop|restart
Kind regards,

Eric
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to recompile squid to enable -enable-storeio=coss ejinh Fedora 2 08-11-2010 04:15 AM
enable tomcat6 service Jordan&&&& SUSE / openSUSE 2 09-21-2008 08:58 AM
installing squid : service squid start --> error jonaskellens Linux - Software 2 09-05-2008 03:06 AM
Telnet service enable? mehmet_yuce Linux - Networking 1 06-30-2008 05:03 PM
how to enable FTP service? hedaPrakash Linux - Newbie 7 07-17-2003 10:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:40 PM.

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