前言:
在斐訊N1上刷了自己曾經從未接觸過的Linux發行版本:Alpine Linux。不過命令行下的界面還是很漂亮的,而且系統簡潔。下面簡單介紹Alpine的配置。
Alpine配置和使用:
0x01.網絡
#網卡配置文件路徑:/etc/network/interfaces
文件內容:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.233
netmask 255.255.255.0
gateway 192.168.1.1
#配置完IP地址,重啟一下網絡服務
/etc/init.d/networking restart
#host文件路徑:/etc/hosts
文件內容:
192.168.1.233 alpine.com
#DNS配置文件路徑:/etc/resolv.conf
文件內容:
nameserver 114.114.114.114
0x02.更新國內源
#Alpine的源文件為:
/etc/apk/repositories,
# 默認的源地址為:http://dl-cdn.alpinelinux.org/
#可以編輯源文件 /etc/apk/repositories,
1 #清華大學的源 2 3 https://mirrors.tuna.tsinghua.edu.cn/alpine/edge/main 4 https://mirrors.tuna.tsinghua.edu.cn/alpine/edge/community 5 https://mirrors.tuna.tsinghua.edu.cn/alpine/edge/testing 6 7 #阿里雲的源 8 9 https://mirrors.aliyun.com/alpine/v3.6/main/ 10 11 https://mirrors.aliyun.com/alpine/v3.6/community/ 12 13 # 中國科技大學的源 14 15 https://mirrors.ustc.edu.cn/alpine/v3.6/main/ 16 https://mirrors.ustc.edu.cn/alpine/v3.6/community/
0x03.軟件包管理工具
alpine 提供了非常好用的apk軟件包管理工具,
可以方便地安裝、刪除、更新軟件。
#查詢openssh相關的軟件包
apk search openssh
#安裝一個軟件包
apk add xxx
#刪除已安裝的xxx軟件包
apk del xxx
#獲取更多apk包管理的命令參數
apk --help
#更新軟件包索引文件
apk update
0x04.安裝常用的網絡相關工具:
#用於文本方式查看網頁,用於測試http協議
apk add curl
#提供了查看網絡連接的協議端口的命令ss,可以替代netstat命令
apk add iproute2
#drill 命令可以替代dig和nslookup DNS查詢命令
apk add drill
#測試192.168.3.166的80端口,查看web服務是否能正常訪問。
curl 192.168.3.166
#查看建立的TCP連接
ss -ta
#查詢域名的信息
drill blog.csdn.net @8.8.8.8
#根據IP地址,反向查找域名
drill -x 8.8.8.8 @47.94.71.34
0x05.開啟SSH服務
#安裝openssh-server服務器
apk add openssh-server
#修改配置文件 /etc/ssh/sshd_config,
#如果要想使用root用戶遠程管理,需要修改參數為:
PermitRootLogin yes
#將ssh服務配置為開機自動啟動
rc-update add sshd
#如果你想立刻生效,可以執行命令:
/etc/init.d/sshd restart