最全的Linux教程,Linux从入门到精通
======================
-
linux从入门到精通(第2版)
-
Linux系统移植
-
Linux驱动开发入门与实战
-
LINUX 系统移植 第2版
-
Linux开源网络全栈详解 从DPDK到OpenFlow
第一份《Linux从入门到精通》466页
====================
内容简介
====
本书是获得了很多读者好评的Linux经典畅销书**《Linux从入门到精通》的第2版**。本书第1版出版后曾经多次印刷,并被51CTO读书频道评为“最受读者喜爱的原创IT技术图书奖”。本书第﹖版以最新的Ubuntu 12.04为版本,循序渐进地向读者介绍了Linux 的基础应用、系统管理、网络应用、娱乐和办公、程序开发、服务器配置、系统安全等。本书附带1张光盘,内容为本书配套多媒体教学视频。另外,本书还为读者提供了大量的Linux学习资料和Ubuntu安装镜像文件,供读者免费下载。
本书适合广大Linux初中级用户、开源软件爱好者和大专院校的学生阅读,同时也非常适合准备从事Linux平台开发的各类人员。
需要《Linux入门到精通》、《linux系统移植》、《Linux驱动开发入门实战》、《Linux开源网络全栈》电子书籍及教程的工程师朋友们劳烦您转发+评论
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
创建服务启动脚本
vim /etc/init.d/squid
#!/bin/bash
#chkconfig: 2345 90 25
PID="/usr/local/squid/var/run/squid.pid"
CONF="/usr/local/squid/etc/squid.conf"
CMD="/usr/local/squid/sbin/squid"
case "$1" in
start)
netstat -natp | grep squid &> /dev/null
if [ $? -eq 0 ]
then
echo "squid is running"
else
echo "正在启动 squid..."
$CMD
fi
;;
stop)
$CMD -k shutdown &> /dev/null #这里可以仔细看下
rm -rf $PID &> /dev/null
;;
status)
[ -f $PID ] &> /dev/null
if [ $? -eq 0 ]
then
netstat -natp | grep squid
else
echo "squid is not running"
fi
;;
restart)
$0 stop &> /dev/null
echo "正在关闭 squid..."
$0 start &> /dev/null
echo "正在启动 squid..."
$CMD
fi
;;
stop)
$CMD -k shutdown &> /dev/null #这里可以仔细看下
rm -rf $PID &> /dev/null
;;
status)
[ -f $PID ] &> /dev/null
if [ $? -eq 0 ]
then
netstat -natp | grep squid
else
echo "squid is not running"
fi
;;
restart)
$0 stop &> /dev/null
echo "正在关闭 squid..."
$0 start &> /dev/null
echo "正在启动 squid..."
;;
reload)
$CMD -k reconfigure
;;
check)
$CMD -k parse
;;
\*)
echo "用法:$0{start|stop|status|reload|check|restart}"
;;
esac
加入开机启动
chmod +x /etc/init.d/squid
chkconfig --add squid
chkconfig --level 35 squid on
脚本测试
[root@host-10-200-86-163 init.d]# netstat -anplt | grep squid
[root@host-10-200-86-163 init.d]# service squid start
正在启动 squid...
[root@host-10-200-86-163 init.d]# netstat -anplt | grep squid
tcp6 0 0 :::3128 :::\* LISTEN 8260/(squid-1)
[root@host-10-200-86-163 init.d]# service squid stop
[root@host-10-200-86-163 init.d]# netstat -anplt | grep squid
创建传统代理
主要修改下图中所圈出的内容
# And finally deny all other access to this proxy
http_access allow all #在deny all前添加allow all
http_access deny all
# Squid normally listens to port 3128
http_port 3128 #squid对外端口
cache_mem 128 MB #指定缓存功能所使用的内存空间大小,便于保持访问较频繁的WEB对象,容量最好为4的倍数,单位为MB,建议设为物理内存的1/4
reply_body_max_size 10 MB #允许用户下载的最大文件大小,以字节为单位。默认设置0表示不进行限制
maximum_object_size 4096 KB #允许保存到缓存空间的最大对象大小,以KB为单位,超过大小限制的文件将不被缓存,而是直接转发给用户
# Uncomment and adjust the following to add a disk cache directory.
#cache\_dir ufs /usr/local/squid/var/cache/squid 100 16 256
# Leave coredumps in the first cache dir
coredump_dir /usr/local/squid/var/cache/squid
#
# Add any of your own refresh\_pattern entries above these.
#
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
cache_effective_user squid #squid运行用户
cache_effective_group squid #squid运行组
重启Squid
#进行配置检查
[root@host-10-200-86-163 init.d]# /usr/local/squid/sbin/squid -k reconfigure
[root@host-10-200-86-163 init.d]# /usr/local/squid/sbin/squid -k check
#重启
[root@host-10-200-86-163 init.d]# service squid restart
正在关闭 squid...
正在启动 squid...
[root@host-10-200-86-163 init.d]# netstat -anplt | grep 3128
tcp6 0 0 :::3128 :::\* LISTEN 8774/(squid-1)
设置Linux服务器内网上网 重新找一台内网的linux服务器 没有设置代理上网前,去curl百度是失败的
[root@sx-sj-mcn-redis-1 ~]# curl www.baidu.com -I
curl: (6) Could not resolve host: www.baidu.com; Unknown error
临时设置代理
[root@sx-sj-mcn-redis-1 ~]# export proxy=http://10.200.86.163:3128; #proxy=http代理http协议的请求
[root@sx-sj-mcn-redis-1 ~]# export http_proxy="http://10.200.86.163:3128";
[root@sx-sj-mcn-redis-1 ~]# export https_proxy="http://10.200.86.163:3128"; #https=proxy代理https协议的请求
临时设置代理后再次curl百度
[root@sx-sj-mcn-redis-1 ~]# curl www.baidu.com -I
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Content-Length: 277
Content-Type: text/html
Date: Thu, 08 Aug 2019 12:40:01 GMT
ETag: "575e1f60-115"
Last-Modified: Mon, 13 Jun 2016 02:50:08 GMT
Pragma: no-cache
Server: bfe/1.0.8.18
X-Cache: MISS from host-10-200-86-163
Via: 1.1 host-10-200-86-163 (squid/4.8)
Connection: keep-alive
永久设置代理
#在/etc/profile中全局设置的最后添加以下配置
[root@sx-sj-mcn-vgateway-2 ~]# vim /etc/profile
export proxy=http://10.200.86.163:3128
export http_proxy="http://10.200.86.163:3128"
export https_proxy="http://10.200.86.163:3128"
export ftp_proxy="http://10.200.86.163:3128"
[root@sx-sj-mcn-vgateway-2 ~]# source /etc/profile
[root@sx-sj-mcn-vgateway-2 ~]# curl www.baidu.com -I
HTTP/1.1 200 OK
Accept-Ranges: bytes
**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**
**[需要这份系统化的资料的朋友,可以点击这里获取!](https://bbs.csdn.net/topics/618542503)**
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**