Ubuntu21.04にsquid をインストールする

1.OSバージョンの確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
root@ubuntu:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 21.04
Release: 21.04
Codename: hirsute
root@ubuntu:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 21.04 Release: 21.04 Codename: hirsute
root@ubuntu:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 21.04
Release: 21.04
Codename: hirsute

2.squidのインストール

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo apt install squid
# sudo apt install squid
# sudo apt install squid

3.squidバージョンの確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
root@ubuntu:~# squid -v
Squid Cache: Version 4.13
Service Name: squid
Ubuntu linux
root@ubuntu:~# squid -v Squid Cache: Version 4.13 Service Name: squid Ubuntu linux
root@ubuntu:~# squid -v
Squid Cache: Version 4.13
Service Name: squid
Ubuntu linux

4.サービスの操作
起動
# sudo systemctl start squid
停止
# sudo systemctl stop squid
再起動
# sudo systemctl restart squid
設定の再読込
# sudo systemctl reload squid

5.フォワードプロキシを設定

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
1209行目 下記を追記
acl cft_localnet src 192.168.0.0/24
139行目 コメントを解除
修正前 #http_access deny to_localhost
修正後 http_access deny to_localhost
1408行目
修正前
http_access allow localhost
修正後
#http_access allow localhost
http_access allow cft_localnet
5611行目 下記を追記
request_header_access Referer deny all
request_header_access X-Forwarded-For deny all
request_header_access Via deny all
request_header_access Cache-Control deny all
8264行目 下記を追記
forwarded_for off
1209行目 下記を追記 acl cft_localnet src 192.168.0.0/24 139行目 コメントを解除 修正前 #http_access deny to_localhost 修正後 http_access deny to_localhost 1408行目 修正前 http_access allow localhost 修正後 #http_access allow localhost http_access allow cft_localnet 5611行目 下記を追記 request_header_access Referer deny all request_header_access X-Forwarded-For deny all request_header_access Via deny all request_header_access Cache-Control deny all 8264行目 下記を追記 forwarded_for off
1209行目 下記を追記 
acl cft_localnet src 192.168.0.0/24

139行目 コメントを解除
修正前 #http_access deny to_localhost
修正後 http_access deny to_localhost

1408行目
修正前
http_access allow localhost
修正後
#http_access allow localhost
http_access allow cft_localnet

5611行目 下記を追記
request_header_access Referer deny all
request_header_access X-Forwarded-For deny all
request_header_access Via deny all
request_header_access Cache-Control deny all

8264行目 下記を追記
forwarded_for off

4.squidを再起動
root@ubuntu:~# systemctl restart squid

IT

Posted by arkgame