هل ترغب في معرفة كيفية تثبيت Squid على Ubuntu Linux؟ في هذا البرنامج التعليمي ، سنوضح لك كيفية تثبيت وتكوين Squid server Squid على إصدار Ubuntu Linux 17.

قائمة الأجهزة:

يعرض القسم التالي قائمة المعدات المستخدمة لإنشاء هذا البرنامج التعليمي Squid.

كل قطعة من الأجهزة المذكورة أعلاه يمكن العثور عليها في موقع أمازون.

الحبار دروس ذات الصلة:

في هذه الصفحة ، نقدم وصولاً سريعًا إلى قائمة من البرامج التعليمية المتعلقة بالحبار.

البرنامج التعليمي - الحبار على أوبونتو لينكس

في وحدة تحكم Linux ، استخدم الأوامر التالية لتعيين المنطقة الزمنية الصحيحة.

# dpkg-reconfigure tzdata

قم بتثبيت حزمة Ntpdate وقم بتعيين التاريخ والوقت الصحيحين على الفور.

# apt-get install ntpdate
# ntpdate pool.ntp.br

في المثال الخاص بنا ، تم استخدام الأمر Ntpdate لضبط التاريخ والوقت الصحيحين باستخدام الخادم البرازيلي pool.ntp.br

دعونا تثبيت خدمة NTP.

# apt-get install ntp

NTP هي الخدمة التي سوف تبقي خادمنا محدثة.

استخدم تاريخ الأمر للتحقق من التاريخ والوقت اللذين تم تكوينهما على نظام التشغيل Ubuntu Linux الخاص بك.

# date

إذا أظهر النظام التاريخ والوقت الصحيح ، فهذا يعني أنك اتبعت جميع الخطوات بشكل صحيح.

استخدم الأوامر التالية لتثبيت الحزم المطلوبة.

# apt-get update
# apt-get install build-essential openssl libssl-dev

قم بتنزيل وتجميع وتثبيت حزمة Squid.

# mkdir /downloads
# cd /downloads
# wget http://www.squid-cache.org/Versions/v3/3.5/squid-3.5.27.tar.gz
# tar -zxvf squid-3.5.27.tar.gz
# cd squid-3.5.27
# ./configure --with-default-user=proxy
# make
# make install

هنا هو ملف التكوين الحبار الأصلية المثبتة بواسطة حزمة الحبار.

# vi /usr/local/squid/etc/squid.conf

acl localnet src 10.0.0.0/8
acl localnet src 172.16.0.0/12
acl localnet src 192.168.0.0/16
acl localnet src fc00::/7
acl localnet src fe80::/10

acl SSL_ports port 443
acl Safe_ports port 80
acl Safe_ports port 21
acl Safe_ports port 443
acl Safe_ports port 70
acl Safe_ports port 210
acl Safe_ports port 1025-65535
acl Safe_ports port 280
acl Safe_ports port 488
acl Safe_ports port 591
acl Safe_ports port 777
acl CONNECT method CONNECT

http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access allow localnet
http_access allow localhost
http_access deny all

http_port 3128

coredump_dir /usr/local/squid/var/cache/squid

refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320

هنا هو ملف جديد مع التكوين لدينا.

تم تمييز الأوامر التي تم تغييرها بالخط العريض.

# vi /usr/local/squid/etc/squid.conf

acl localnet src 192.168.0.0/24  # My internal Network

acl SSL_ports port 443
acl Safe_ports port 80
acl Safe_ports port 21
acl Safe_ports port 443
acl Safe_ports port 70
acl Safe_ports port 210
acl Safe_ports port 1025-65535
acl Safe_ports port 280
acl Safe_ports port 488
acl Safe_ports port 591
acl Safe_ports port 777
acl CONNECT method CONNECT

http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access allow localnet
http_access allow localhost
http_access deny all

http_port 3128

coredump_dir /usr/local/squid/var/cache/squid
cache_dir ufs /usr/local/squid/var/cache/squid 1000 16 256  # 1GB as Cache

refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320

تهيئتي بسيطة فقط.

يوصى بشدة بدراسة ملف التكوين هذا لتحسين التكوين الخاص بك.

استخدم الأمر التالي لإنشاء مجلدات التخزين المؤقت الضرورية.

# chown -R proxy:proxy /usr/local/squid -R
# /usr/local/squid/sbin/squid -z

استخدم الأمر التالي لبدء خدمة Squid.

# /usr/local/squid/sbin/squid -d 10

إذا كان كل شيء يعمل بشكل صحيح ، يجب أن تشاهد الرسائل التالية على الشاشة:

Starting Squid Cache version 3.5.27 for x86_64-pc-linux-gnu...
Service Name: squid
Process ID 19569
Process Roles: worker
With 1024 file descriptors available
Initializing IP Cache...
DNS Socket created at [::], FD 6
DNS Socket created at 0.0.0.0, FD 8
Adding nameserver 172.31.0.2 from /etc/resolv.conf
Adding domain us-west-2.compute.internal from /etc/resolv.conf
Logfile: opening log daemon:/usr/local/squid/var/logs/access.log
Logfile Daemon: opening log /usr/local/squid/var/logs/access.log
Unlinkd pipe opened on FD 14
Store logging disabled
Swap maxSize 1024000 + 262144 KB, estimated 98934 objects
Target number of buckets: 4946
Using 8192 Store buckets
Max Mem size: 262144 KB
Max Swap size: 1024000 KB
Rebuilding storage in /usr/local/squid/var/cache/squid (no log)
Using Least Load store dir selection
Set Current Directory to /usr/local/squid/var/cache/squid
Finished loading MIME types and icons.
HTCP Disabled.
Squid plugin modules loaded: 0
Adaptation support is off.
Accepting HTTP Socket connections at local=[::]:3128 remote=[::] FD 16 flags=9
Done scanning /usr/local/squid/var/cache/squid dir (0 entries)
Finished rebuilding storage from disk.
0 Entries scanned
0 Invalid entries.
0 With invalid flags.
0 Objects loaded.
0 Objects expired.
0 Objects cancelled.
0 Duplicate URLs purged.
0 Swapfile clashes avoided.
Took 0.04 seconds ( 0.00 objects/sec).
Beginning Validation Procedure
Completed Validation Procedure
Validated 0 Entries
store_swap_size = 0.00 KB
storeLateRelease: released 0 objects

لاختبار التثبيت ، انتقل إلى كمبيوتر موجود على شبكتك الداخلية وقم بتكوين متصفحه لاستخدام عنوان IP الخاص بخادم Squid ومنفذ TCP 3128 كخادم وكيل.