常用安装命令
系统升级
普通方法:apt-get update
如果报错解决方法:apt update -y
安装sudo
apt-get install sudo
安装bash
- 打开终端并输入以下命令以安装Bash:
sudo apt-get update
sudo apt-get install bash
- 等待安装完成后,您可以通过输入以下命令来验证Bash是否已成功安装:
bash --version
- 如果您看到了Bash的版本信息,则说明Bash已成功安装。
安装curl
要在Debian 10上安装Curl,请运行以下命令:sudo apt install curl。如果您想验证curl是否已安装,请在终端中输入curl并按Enter键。如果curl已安装,则会输出以下消息:curl: try 'curl --help' or 'curl --manual' for more information 。
在Debian上安装Curl
Curl软件包包含在默认的Debian 10存储库中,要安装它,请运行以下命令:
sudo apt install curl
要确认curl已安装,请输入curl您的终端,然后按Enter:
curl
该命令将输出以下输出:
curl: try 'curl --help' or 'curl --manual' for more information
而已!您已经成功安装curl了Debian机器,并且可以开始使用它了。
使用cURL
不带任何选项使用时curl,将指定为参数的URL的源代码输出到标准输出:
curl https://example.com
要下载带有curl的文件,请使用-o或-O标志。
小写-o选项允许您指定保存文件的名称:
curl -o linux.tar.xz https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.5.tar.xz
大写-O以其原始文件名保存文件:
curl -O https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.5.tar.xz
Curl的另一个有用功能是它能够显示给定URL的HTTP标头:
curl -I https://www.debian.org/
输出
HTTP/1.1 200 OK
Date: Mon, 09 Sep 2019 21:22:30 GMT
Server: Apache
Content-Location: index.en.html
Vary: negotiate,accept-language,Accept-Encoding,cookie
TCN: choice
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
Referrer-Policy: no-referrer
X-Xss-Protection: 1
Strict-Transport-Security: max-age=15552000
Last-Modified: Mon, 09 Sep 2019 08:52:31 GMT
ETag: "38e4-5921ae8851520"
Accept-Ranges: bytes
Content-Length: 14564
Cache-Control: max-age=86400
Expires: Tue, 10 Sep 2019 21:22:30 GMT
X-Clacks-Overhead: GNU Terry Pratchett
Content-Type: text/html
Content-Language: en
使用Curl,您还可以从FTP服务器下载受密码保护的文件:
curl -u FTP_USERNAME:FTP_PASSWORD ftp://ftp.example.com/file.tar.gz
防火墙
刚刚接触服务器踩的坑,以下适合Linux Bebian10操作系统的服务器,开启防火墙以及端口持久化的方法
如果遇到创建服务器的时候报错服务器错误,或者点击日志发现主机拒绝访问这种情况可能是服务器的防火墙没有开启
排查方法:telnet:prot 看是否可以连通
如果没法连通需要开放防火墙端口
首先安装 iptables(通常系统都会自带,如果没有就需要安装),使用以下命令
sudo apt-get update
sudo apt-get install iptables
安装成功后使用以下命令开放一个个端口
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
开启一个范围的端口
iptables -A INPUT -p tcp --dport 51000:60000 -j ACCEPT
设置完就已经放行了指定的端口,但重启后会失效,所以需要设置持续生效规则:
输入以下安装 iptables-persistent
sudo apt-get install iptables-persistent
输入以下命令保存规则持续生效
netfilter-persistent save
netfilter-persistent reload
完成之后端口就会持续开放。
查看某条规则下的防火墙开放端口
#查看全部规则 iptables -L --line-numbers#查看ufw-user-input 规则 iptables -L ufw-user-input --line-numbers
授权开放防火墙端口
iptables -I INPUT -p tcp --dport 795 -j ACCEPT
授权关闭防火墙端口
iptables -D INPUT -p tcp --dport 8888 -j ACCEPT
删除某条规则
iptables -D ufw-user-input 6
查看正常服务的对外端口
netstat -tlpn
保存防火墙规则
如果没有安装iptables-persistent则先安装iptables-persistent
sudo apt-get install iptables-persistent
输入以下命令保存规则持续生效
netfilter-persistent savenetfilter-persistent reload








Comments 16 条评论
Muchas gracias. ?Como puedo iniciar sesion?
@pgwrvuecbj Sorry, I did not create a login system.
I’ll right away grab your rss as I can not to find your email subscription link or e-newsletter service. Do you have any? Please permit me recognize so that I could subscribe. Thanks.
I’ll right away take hold of your rss as I can not find your email subscription hyperlink or e-newsletter service. Do you have any? Kindly allow me understand in order that I may subscribe. Thanks.
Wow, this post is nice, my younger sister is analyzing such things, thus I am going to tell her.
I just could not leave your website prior to suggesting that I really loved the standard information a person provide to your guests? Is going to be again ceaselessly to inspect new posts
I love what you guys are up too. This kind of clever work and exposure! Keep up the great works guys I’ve included you guys to my blogroll.
我经常计划, 看到你们相册那样的地方。谢谢启发。 [url=https://iqvel.com/zh-Hans/a/%E5%B8%8C%E8%85%8A/%E8%8E%B1%E6%96%AF%E6%B2%83%E6%96%AF%E5%B2%9B]石化森林[/url] 研究你的文章, 我感受到, 各国更亲近。谢谢 旅行灵感。
Fastidious response in return of this question with firm arguments and telling everything about that.
I like what you guys are usually up too. This sort of clever work and exposure! Keep up the fantastic works guys I’ve incorporated you guys to my blogroll.
Thanks a lot for sharing this with all people you really know what you’re talking about! Bookmarked. Please also discuss with my website =). We can have a hyperlink trade arrangement among us!
I am sure this post has touched all the internet users, its really really pleasant article on building up new website.
I’ll right away take hold of your rss feed as I can not in finding your e-mail subscription hyperlink or newsletter service. Do you’ve any? Please let me recognize so that I may subscribe. Thanks.
I love what you guys tend to be up too. This sort of clever work and reporting! Keep up the amazing works guys I’ve added you guys to my own blogroll.
This paragraph offers clear idea in support of the new people of blogging, that in fact how to do blogging.
always i used to read smaller articles which also clear their motive, and that is also happening with this paragraph which I am reading at this time.