menu Chancel's blog
rss_feed
Chancel's blog
有善始者实繁,能克终者盖寡。

Alpine网络配置以及初始化工作

作者:Chancel Yang, 创建:2022-08-12, 字数:1613, 已阅:140, 最后更新:2022-08-12

这篇文章更新于 623 天前,文中部分信息可能失效,请自行甄别无效内容。

安装完Alpine后通常默认是root账户,为了顺利使用Alpine,需要做一些简单的初始化工作

以下实践系统版本为3.16.1

修改网络设置为静态ip

Bash
vi /etc/network/interfaces

# /etc/network/interfaces参考如下
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.4.61
        netmask 255.255.240.0
        gateway 192.168.2.1
        nameserver 114.114.114.114

重启网络

Bash
service networking restart

取消注释第三方库,将开头的#全部取消,根据需要修改第三方源(这里用阿里云源)

Bash
vi /etc/apk/repositories

# /etc/apk/repositories配置如下
http://mirrors.aliyun.com/alpine/v3.16/main
http://mirrors.aliyun.com/alpine/v3.16/community
http://mirrors.aliyun.com/alpine/edge/main
http://mirrors.aliyun.com/alpine/edge/community
http://mirrors.aliyun.com/alpine/edge/testing

升级第三方库列表并安装常用软件,根据需要自行筛选软件

Bash
apk update
apk add wget curl vim git supversior proxychains-ng zsh sudo build-base openssl-dev zlib-dev libffi-dev  make automake gcc g++ subversion python3-dev

初始化用户,这里使用较为方便的sudo程序(上面已安装)

Bash
adduser chancel

编辑sudoers程序的默认配置文件/etc/sudoers,添加用户chancel的超级管理员权限

Bash
chmod +w /etc/sudoers
vim /etc/sudoers

    # 找到如下root的一行,并添加用户chancel的权限
    ...
    root ALL=(ALL:ALL) ALL
    chancel ALL=(ALL) ALL

chmod -w /etc/sudoers

退出root登录,使用用户chancel进行登录并设置sh为zsh

修改chancel的登录默认sh程序为zsh

Bash
sudo vim /etc/passwd

# /etc/passwd文件参考如下
...
nobody:x:65534:65534:nobody:/:/sbin/nologin
chancel:x:1000:1000:Linux User,,,:/home/chancel:/bin/zsh

最后安装oh-my-zsh作为zsh的默认配置

Bash
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

出于安全考虑,要进一步禁止root登录以及配置用户证书等部分不再赘述


[[replyMessage== null?"发表评论":"发表评论 @ " + replyMessage.m_author]]

account_circle
email
web_asset
textsms

评论列表([[messageResponse.total]])

还没有可以显示的留言...
[[messageItem.m_author]] [[messageItem.m_author]]
[[messageItem.create_time]]
[[getEnviron(messageItem.m_environ)]]
[[subMessage.m_author]] [[subMessage.m_author]] @ [[subMessage.parent_message.m_author]] [[subMessage.parent_message.m_author]]
[[subMessage.create_time]]
[[getEnviron(messageItem.m_environ)]]