Debian/Ubuntu命令方式快速安装squid

转自:http://www.netren.org/index.php/jeffreyguo/214-debian-ubuntu-squid.html

一、运行squid安装命令

root@netren:~# apt-get install squid
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
squid-common squid-langpack
Suggested packages:
squidclient squid-cgi logcheck-database resolvconf smbclient winbind
The following NEW packages will be installed:
squid squid-common squid-langpack  (这几个软件包将被安装)
0 upgraded, 3 newly installed, 0 to remove and 4 not upgraded.
Need to get 1,347kB of archives.
After this operation, 8,503kB of additional disk space will be used.
Do you want to continue [Y/n]?y
Get:1 http://hk.archive.ubuntu.com/ubuntu/ lucid/main squid-langpack 20100111-1 [228kB]
Get:2 http://hk.archive.ubuntu.com/ubuntu/ lucid/main squid-common 2.7.STABLE7-1ubuntu12 [353kB] (版本是2.7.STABLE7)
Get:3 http://hk.archive.ubuntu.com/ubuntu/ lucid/main squid 2.7.STABLE7-1ubuntu12 [766kB]
Fetched 1,347kB in 7s (180kB/s)
Preconfiguring packages ...
Selecting previously deselected package squid-langpack.
(Reading database ... 43247 files and directories currently installed.)
Unpacking squid-langpack (from .../squid-langpack_20100111-1_all.deb) ...
Selecting previously jeffrey guo deselected package squid-common.
Unpacking squid-common (from .../squid-common_2.7.STABLE7-1ubuntu12_all.deb) ...
Selecting previously deselected package squid.
Unpacking squid (from .../squid_2.7.STABLE7-1ubuntu12_i386.deb) ...
Processing triggers for ureadahead ...
Processing triggers for man-db ...
Setting up squid-langpack (20100111-1) ...
Setting up squid-common (2.7.STABLE7-1ubuntu12) ...

Setting up squid (2.7.STABLE7-1ubuntu12) ...
Creating squid spool directory structure
2011/01/05 18:05:08| Creating Swap Directories (安装时自动创建了cache缓存目录)

二、完成安装,进行查看:

root@netren:~# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1661/mysqld
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      2433/apache2
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      597/sshd
tcp        0      0 0.0.0.0:3128            0.0.0.0:*               LISTEN      2601/(squid) (squid端口正在监听运行)

三、squid在系统内的安装信息:

那么,它到底将安装目录及配置文件放在哪里了呢?
/etc/default/squid
/etc/init/squid.conf
/etc/init.d/squid (服务管理中添加了squid)
/etc/logrotate.d/squid (日志管理中添加了squid)   
/etc/resolvconf/update-libc.d/squid
/etc/squid/squid.conf (主要配置文件)
/usr/lib/squid/squid_session
/usr/lib/squid/squid_unix_group
/usr/lib/squid/unlinkd
/usr/lib/squid/wbinfo_group.pl
/usr/lib/squid/yp_auth
/usr/sbin/squid (添加了squid命令到sbin目录)
/usr/share/squid (添加了squid共享文档目录)
/usr/share/squid-langpack (添加了squid语言包的共享文档目录)
/usr/share/doc/squid  (添加了squid说明文档目录)
/usr/share/squid/errors  (添加了squid多国语言的报错文档目录)
/usr/share/squid-langpack/en/ERR_FTP_FAILURE
/usr/share/squid-langpack/zh-cn/ERR_CONNECT_FAIL   (squid多国语言的报错文档目录)
/usr/share/squid-langpack/zh-cn/ERR_DIR_LISTING
/usr/share/squid-langpack/zh-tw/ERR_WRITE_ERROR
/usr/share/squid-langpack/zh-tw/ERR_ZERO_SIZE_OBJECT
/var/log/squid      (squid日志文件目录)
/var/spool/squid (是其默认安装的缓冲目录)
root@netren:/var/spool/squid# ls
00  01  02  03  04  05  06  07  08  09  0A  0B  0C  0D  0E  0F  swap.state


并且为系统新建了名为proxy的用户和组
root@netren:~# grep proxy /etc/passwd /etc/group
/etc/passwd:proxy:x:13:13:proxy:/bin:/bin/sh
/etc/group:proxy:x:13:


四、如何启动或停止squdi?

启动squid程序:
方法1、root@netren:~# squid   直接以命令形式运行squid
方法2、root@netren:~# /etc/init.d/squid start  通过程序管理器(脚本)来运行squid
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service squid start

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the start(8) utility, e.g. start squid
squid start/running, process 2718

停止squid程序:
方法1、root@netren:~# squid -k shutdown  进行停止
方法2、root@netren:~# /etc/init.d/squid stop   通过程序管理器(脚本)来停止squid
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service squid stop

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) utility, e.g. stop squid
squid stop/waiting


关于squid安装后的测试以及在客户端的设置、透明代理设置。请参考《Squid安装与配置笔记(Debian/ubuntu)

你可能感兴趣的:(Debian/Ubuntu命令方式快速安装squid)