目录

  • 一:Alpine Linux开启SSH远程登陆

    • 1.简介:
    • 2.配置
    • 3.配置命令
    • 4.重启服务
  • 二:Alpine Linux源管理
    • 1.简介
    • 2.国内源简介:
    • 3.配置:
    • 3.我的配置:
  • 三:Alpine Linux 包管理
    • 1.简介
    • 2.apk update
    • 3.apk search
    • 4.apk add
    • 5.apk info
    • 6.apk upgrade
    • 7.apk del
  • 四:Alpine Linux服务管理
    • 1.简介
    • 2.rc-update
    • 3.rc-status
    • 4.rc-service
    • 5.openrc
    • 6.我常用的RC系列命令
  • 五:关机重启

回到顶部

一:Alpine Linux开启SSH远程登陆

1.简介:

最重要的一个服务了,远程登陆需要用它,文件传输需要用它,必备功能。不管你是在实体机上跑,虚拟机上跑,docker里面跑,这个都是必须的。

2.配置

配置文件位置:/etc/ssh/sshd_config

配置文件选项:#PermitRootLogin prohibit-password

修改为:PermitRootLogin yes

3.配置命令

看不懂上面的,直接用下面这句。

sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config

4.重启服务

改了配置不会直接生效,需要重启服务器或者服务。

重启服务器:reboot

重启服务:rc-service sshd restart

回到顶部

二:Alpine Linux源管理

1.简介

源这个概念在linux早就存在了,其实就是类似于软件市场的存在,apple在iphone上发扬光大了,并且自己管理安全的软件,使得iphone上软件兼容性等等问题得到改善,用户体验比较好,android基于linux核心开发,也有了软件市场,最著名的就是google市场,因为被墙,所以国内各个大软件厂商也都有了自己的市场。

每个市场(源)都有自己的服务器,linux默认的都是外国的服务器,我们访问比较慢,所以就有了镜像服务器放在国内,让我们访问快一些。管理源,就是增加镜像服务器。

而且,linux因为是大众维护更新代码,所以还区分了稳定版,测试版……各种版本的市场,这些都需要进行源管理。

2.国内源简介:

这几个都有alpine的源

清华大学:https://mirror.tuna.tsinghua.edu.cn/alpine/

阿里云:https://mirrors.aliyun.com/alpine/

中科大:http://mirrors.ustc.edu.cn/alpine/

还有一些没有alpine的

网易:http://mirrors.163.com/

3.配置:

直接抄中科大的帮助http://mirrors.ustc.edu.cn/help/alpine.html

一般情况下,将 /etc/apk/repositories 文件中 Alpine 默认的源地址 http://dl-cdn.alpinelinux.org/ 替换为 http://mirrors.ustc.edu.cn/ 即可。

可以使用如下命令:

sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories

也可以直接编辑 /etc/apk/repositories 文件。以下是 v3.5 版本的参考配置:

https://mirrors.ustc.edu.cn/alpine/v3.5/main
https://mirrors.ustc.edu.cn/alpine/v3.5/community

也可以使用 latest-stable 指向最新的稳定版本:

https://mirrors.ustc.edu.cn/alpine/latest-stable/main
https://mirrors.ustc.edu.cn/alpine/latest-stable/community

更改完 /etc/apk/repositories 文件后请运行 apk update 更新索引以生效。

3.我的配置:

打开/etc/apk/repositories后发现,中科大的sed命令无效,因为默认的源不是dl-cdn

自己改一下吧

原:

#/media/cdrom/apks
http://ftp.halifax.rwth-aachen.de/alpine/v3.7/main
#http://ftp.halifax.rwth-aachen.de/alpine/v3.7/community
#http://ftp.halifax.rwth-aachen.de/alpine/edge/main
#http://ftp.halifax.rwth-aachen.de/alpine/edge/community
#http://ftp.halifax.rwth-aachen.de/alpine/edge/testinghttp://mirror.yandex.ru/mirrors/alpine/v3.7/main
#http://mirror.yandex.ru/mirrors/alpine/v3.7/community
#http://mirror.yandex.ru/mirrors/alpine/edge/main
#http://mirror.yandex.ru/mirrors/alpine/edge/community
#http://mirror.yandex.ru/mirrors/alpine/edge/testing

改为:

http://mirrors.ustc.edu.cn/alpine/v3.7/main
http://mirrors.ustc.edu.cn/alpine/v3.7/community
http://mirrors.ustc.edu.cn/alpine/edge/main
http://mirrors.ustc.edu.cn/alpine/edge/community
http://mirrors.ustc.edu.cn/alpine/edge/testing

转存失败重新上传取消

也可以复制下面这组命令,一次执行

转存失败重新上传取消

echo http://mirrors.ustc.edu.cn/alpine/v3.7/main >/etc/apk/repositories
echo http://mirrors.ustc.edu.cn/alpine/v3.7/community >>/etc/apk/repositories
echo http://mirrors.ustc.edu.cn/alpine/edge/main >>/etc/apk/repositories
echo http://mirrors.ustc.edu.cn/alpine/edge/community >>/etc/apk/repositories
echo http://mirrors.ustc.edu.cn/alpine/edge/testing >>/etc/apk/repositories

或者

转存失败重新上传取消

echo 'http://mirrors.ustc.edu.cn/alpine/v3.7/main
http://mirrors.ustc.edu.cn/alpine/v3.7/community
http://mirrors.ustc.edu.cn/alpine/edge/main
http://mirrors.ustc.edu.cn/alpine/edge/community
http://mirrors.ustc.edu.cn/alpine/edge/testing' >/etc/apk/repositories

回到顶部

三:Alpine Linux 包管理

1.简介

Alpine使用apk进行包管理,下面介绍常用命令

2.apk update

$ apk update #更新最新镜像源列表

3.apk search

$ apk search #查找所以可用软件包
$ apk search -v #查找所以可用软件包及其描述内容
$ apk search -v 'acf*' #通过软件包名称查找软件包
$ apk search -v -d 'docker' #通过描述文件查找特定的软件包

4.apk add

$ apk add openssh #安装一个软件
$ apk add openssh openntp vim   #安装多个软件
$ apk add --no-cache mysql-client  #不使用本地镜像源缓存,相当于先执行update,再执行add

5.apk info

$ apk info #列出所有已安装的软件包
$ apk info -a zlib #显示完整的软件包信息
$ apk info --who-owns /sbin/lbu #显示指定文件属于的包

6.apk upgrade

$ apk upgrade #升级所有软件
$ apk upgrade openssh #升级指定软件
$ apk upgrade openssh openntp vim   #升级多个软件
$ apk add --upgrade busybox #指定升级部分软件包

7.apk del

$ apk del openssh  #删除一个软件

回到顶部

四:Alpine Linux服务管理

1.简介

alpine没有使用fedora的systemctl来进行服务管理,使用的是RC系列命令

2.rc-update

rc-update主要用于不同运行级增加或者删除服务。

alpine:~# rc-update --help
Usage: rc-update [options] add <service> [<runlevel>...]or: rc-update [options] del <service> [<runlevel>...]or: rc-update [options] [show [<runlevel>...]]Options: [ asuChqVv ]-a, --all                         Process all runlevels-s, --stack                       Stack a runlevel instead of a service-u, --update                      Force an update of the dependency tree-h, --help                        Display this help output-C, --nocolor                     Disable color output-V, --version                     Display software version-v, --verbose                     Run verbosely-q, --quiet                       Run quietly (repeat to suppress errors)

转存失败重新上传取消

3.rc-status

rc-status 主要用于运行级的状态管理。

alpine:~# rc-status --help
Usage: rc-status [options] <runlevel>...or: rc-status [options] [-a | -c | -l | -m | -r | -s | -u]Options: [ aclmrsuChqVv ]-a, --all                         Show services from all run levels-c, --crashed                     Show crashed services-l, --list                        Show list of run levels-m, --manual                      Show manually started services-r, --runlevel                    Show the name of the current runlevel-s, --servicelist                 Show service list-u, --unused                      Show services not assigned to any runlevel-h, --help                        Display this help output-C, --nocolor                     Disable color output-V, --version                     Display software version-v, --verbose                     Run verbosely-q, --quiet                       Run quietly (repeat to suppress errors)

4.rc-service

rc-service主用于管理服务的状态

alpine:~# rc-service --help
Usage: rc-service [options] [-i] <service> <cmd>...or: rc-service [options] -e <service>or: rc-service [options] -lor: rc-service [options] -r <service>Options: [ ce:ilr:INChqVv ]-e, --exists <arg>                tests if the service exists or not-c, --ifcrashed                   if the service is crashed then run the command-i, --ifexists                    if the service exists then run the command-I, --ifinactive                  if the service is inactive then run the command-N, --ifnotstarted                if the service is not started then run the command-l, --list                        list all available services-r, --resolve <arg>               resolve the service name to an init script-h, --help                        Display this help output-C, --nocolor                     Disable color output-V, --version                     Display software version-v, --verbose                     Run verbosely-q, --quiet                       Run quietly (repeat to suppress errors)

转存失败重新上传取消

5.openrc

openrc主要用于管理不同的运行级。

alpine:~# openrc --help
Usage: openrc [options] [<runlevel>]Options: [ a:no:s:SChqVv ]-n, --no-stop                     do not stop any services-o, --override <arg>              override the next runlevel to change intowhen leaving single user or boot runlevels-s, --service <arg>               runs the service specified with the restof the arguments-S, --sys                         output the RC system type, if any-h, --help                        Display this help output-C, --nocolor                     Disable color output-V, --version                     Display software version-v, --verbose                     Run verbosely-q, --quiet                       Run quietly (repeat to suppress errors)

6.我常用的RC系列命令

1.增加服务到系统启动时运行,下例为docker

rc-update add docker boot

2.重启网络服务

rc-service networking restart

3.列出所有服务

rc-status -a

回到顶部

五:关机重启

$ reboot #重启系统
$ poweroff #关机

目录

  • 一:Alpine Linux开启SSH远程登陆

    • 1.简介:
    • 2.配置
    • 3.配置命令
    • 4.重启服务
  • 二:Alpine Linux源管理
    • 1.简介
    • 2.国内源简介:
    • 3.配置:
    • 3.我的配置:
  • 三:Alpine Linux 包管理
    • 1.简介
    • 2.apk update
    • 3.apk search
    • 4.apk add
    • 5.apk info
    • 6.apk upgrade
    • 7.apk del
  • 四:Alpine Linux服务管理
    • 1.简介
    • 2.rc-update
    • 3.rc-status
    • 4.rc-service
    • 5.openrc
    • 6.我常用的RC系列命令
  • 五:关机重启

回到顶部

一:Alpine Linux开启SSH远程登陆

1.简介:

最重要的一个服务了,远程登陆需要用它,文件传输需要用它,必备功能。不管你是在实体机上跑,虚拟机上跑,docker里面跑,这个都是必须的。

2.配置

配置文件位置:/etc/ssh/sshd_config

配置文件选项:#PermitRootLogin prohibit-password

修改为:PermitRootLogin yes

3.配置命令

看不懂上面的,直接用下面这句。

sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config

4.重启服务

改了配置不会直接生效,需要重启服务器或者服务。

重启服务器:reboot

重启服务:rc-service sshd restart

回到顶部

二:Alpine Linux源管理

1.简介

源这个概念在linux早就存在了,其实就是类似于软件市场的存在,apple在iphone上发扬光大了,并且自己管理安全的软件,使得iphone上软件兼容性等等问题得到改善,用户体验比较好,android基于linux核心开发,也有了软件市场,最著名的就是google市场,因为被墙,所以国内各个大软件厂商也都有了自己的市场。

每个市场(源)都有自己的服务器,linux默认的都是外国的服务器,我们访问比较慢,所以就有了镜像服务器放在国内,让我们访问快一些。管理源,就是增加镜像服务器。

而且,linux因为是大众维护更新代码,所以还区分了稳定版,测试版……各种版本的市场,这些都需要进行源管理。

2.国内源简介:

这几个都有alpine的源

清华大学:https://mirror.tuna.tsinghua.edu.cn/alpine/

阿里云:https://mirrors.aliyun.com/alpine/

中科大:http://mirrors.ustc.edu.cn/alpine/

还有一些没有alpine的

网易:http://mirrors.163.com/

3.配置:

直接抄中科大的帮助http://mirrors.ustc.edu.cn/help/alpine.html

一般情况下,将 /etc/apk/repositories 文件中 Alpine 默认的源地址 http://dl-cdn.alpinelinux.org/ 替换为 http://mirrors.ustc.edu.cn/ 即可。

可以使用如下命令:

sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories

也可以直接编辑 /etc/apk/repositories 文件。以下是 v3.5 版本的参考配置:

https://mirrors.ustc.edu.cn/alpine/v3.5/main
https://mirrors.ustc.edu.cn/alpine/v3.5/community

也可以使用 latest-stable 指向最新的稳定版本:

https://mirrors.ustc.edu.cn/alpine/latest-stable/main
https://mirrors.ustc.edu.cn/alpine/latest-stable/community

更改完 /etc/apk/repositories 文件后请运行 apk update 更新索引以生效。

3.我的配置:

打开/etc/apk/repositories后发现,中科大的sed命令无效,因为默认的源不是dl-cdn

自己改一下吧

原:

#/media/cdrom/apks
http://ftp.halifax.rwth-aachen.de/alpine/v3.7/main
#http://ftp.halifax.rwth-aachen.de/alpine/v3.7/community
#http://ftp.halifax.rwth-aachen.de/alpine/edge/main
#http://ftp.halifax.rwth-aachen.de/alpine/edge/community
#http://ftp.halifax.rwth-aachen.de/alpine/edge/testinghttp://mirror.yandex.ru/mirrors/alpine/v3.7/main
#http://mirror.yandex.ru/mirrors/alpine/v3.7/community
#http://mirror.yandex.ru/mirrors/alpine/edge/main
#http://mirror.yandex.ru/mirrors/alpine/edge/community
#http://mirror.yandex.ru/mirrors/alpine/edge/testing

改为:

http://mirrors.ustc.edu.cn/alpine/v3.7/main
http://mirrors.ustc.edu.cn/alpine/v3.7/community
http://mirrors.ustc.edu.cn/alpine/edge/main
http://mirrors.ustc.edu.cn/alpine/edge/community
http://mirrors.ustc.edu.cn/alpine/edge/testing

也可以复制下面这组命令,一次执行

echo http://mirrors.ustc.edu.cn/alpine/v3.7/main >/etc/apk/repositories
echo http://mirrors.ustc.edu.cn/alpine/v3.7/community >>/etc/apk/repositories
echo http://mirrors.ustc.edu.cn/alpine/edge/main >>/etc/apk/repositories
echo http://mirrors.ustc.edu.cn/alpine/edge/community >>/etc/apk/repositories
echo http://mirrors.ustc.edu.cn/alpine/edge/testing >>/etc/apk/repositories

转存失败重新上传取消

或者

echo 'http://mirrors.ustc.edu.cn/alpine/v3.7/main
http://mirrors.ustc.edu.cn/alpine/v3.7/community
http://mirrors.ustc.edu.cn/alpine/edge/main
http://mirrors.ustc.edu.cn/alpine/edge/community
http://mirrors.ustc.edu.cn/alpine/edge/testing' >/etc/apk/repositories

回到顶部

三:Alpine Linux 包管理

1.简介

Alpine使用apk进行包管理,下面介绍常用命令

2.apk update

$ apk update #更新最新镜像源列表

3.apk search

$ apk search #查找所以可用软件包
$ apk search -v #查找所以可用软件包及其描述内容
$ apk search -v 'acf*' #通过软件包名称查找软件包
$ apk search -v -d 'docker' #通过描述文件查找特定的软件包

4.apk add

$ apk add openssh #安装一个软件
$ apk add openssh openntp vim   #安装多个软件
$ apk add --no-cache mysql-client  #不使用本地镜像源缓存,相当于先执行update,再执行add

5.apk info

$ apk info #列出所有已安装的软件包
$ apk info -a zlib #显示完整的软件包信息
$ apk info --who-owns /sbin/lbu #显示指定文件属于的包

6.apk upgrade

$ apk upgrade #升级所有软件
$ apk upgrade openssh #升级指定软件
$ apk upgrade openssh openntp vim   #升级多个软件
$ apk add --upgrade busybox #指定升级部分软件包

7.apk del

$ apk del openssh  #删除一个软件

回到顶部

四:Alpine Linux服务管理

1.简介

alpine没有使用fedora的systemctl来进行服务管理,使用的是RC系列命令

2.rc-update

rc-update主要用于不同运行级增加或者删除服务。

alpine:~# rc-update --help
Usage: rc-update [options] add <service> [<runlevel>...]or: rc-update [options] del <service> [<runlevel>...]or: rc-update [options] [show [<runlevel>...]]Options: [ asuChqVv ]-a, --all                         Process all runlevels-s, --stack                       Stack a runlevel instead of a service-u, --update                      Force an update of the dependency tree-h, --help                        Display this help output-C, --nocolor                     Disable color output-V, --version                     Display software version-v, --verbose                     Run verbosely-q, --quiet                       Run quietly (repeat to suppress errors)

3.rc-status

rc-status 主要用于运行级的状态管理。

alpine:~# rc-status --help
Usage: rc-status [options] <runlevel>...or: rc-status [options] [-a | -c | -l | -m | -r | -s | -u]Options: [ aclmrsuChqVv ]-a, --all                         Show services from all run levels-c, --crashed                     Show crashed services-l, --list                        Show list of run levels-m, --manual                      Show manually started services-r, --runlevel                    Show the name of the current runlevel-s, --servicelist                 Show service list-u, --unused                      Show services not assigned to any runlevel-h, --help                        Display this help output-C, --nocolor                     Disable color output-V, --version                     Display software version-v, --verbose                     Run verbosely-q, --quiet                       Run quietly (repeat to suppress errors)

4.rc-service

rc-service主用于管理服务的状态

alpine:~# rc-service --help
Usage: rc-service [options] [-i] <service> <cmd>...or: rc-service [options] -e <service>or: rc-service [options] -lor: rc-service [options] -r <service>Options: [ ce:ilr:INChqVv ]-e, --exists <arg>                tests if the service exists or not-c, --ifcrashed                   if the service is crashed then run the command-i, --ifexists                    if the service exists then run the command-I, --ifinactive                  if the service is inactive then run the command-N, --ifnotstarted                if the service is not started then run the command-l, --list                        list all available services-r, --resolve <arg>               resolve the service name to an init script-h, --help                        Display this help output-C, --nocolor                     Disable color output-V, --version                     Display software version-v, --verbose                     Run verbosely-q, --quiet                       Run quietly (repeat to suppress errors)

5.openrc

openrc主要用于管理不同的运行级。

alpine:~# openrc --help
Usage: openrc [options] [<runlevel>]Options: [ a:no:s:SChqVv ]-n, --no-stop                     do not stop any services-o, --override <arg>              override the next runlevel to change intowhen leaving single user or boot runlevels-s, --service <arg>               runs the service specified with the restof the arguments-S, --sys                         output the RC system type, if any-h, --help                        Display this help output-C, --nocolor                     Disable color output-V, --version                     Display software version-v, --verbose                     Run verbosely-q, --quiet                       Run quietly (repeat to suppress errors)

6.我常用的RC系列命令

1.增加服务到系统启动时运行,下例为docker

rc-update add docker boot

2.重启网络服务

rc-service networking restart

3.列出所有服务

rc-status -a

回到顶部

五:关机重启

$ reboot #重启系统
$ poweroff #关机

Alpine Linux常用命令相关推荐

  1. Linux常用命令帅哥特供版

    [TOC] Linux常用命令Json帅哥特供版 没错这里的帅哥指的就是我自己 把/dev/null看作"黑洞". 它非常等价于一个只写文件. 所有写入它的内容都会永远丢失. 而尝 ...

  2. linux常用命令(转载)

    Linux常用命令大全(非常全!!!) 最近都在和Linux打交道,感觉还不错.我觉得Linux相比windows比较麻烦的就是很多东西都要用命令来控制,当然,这也是很多人喜欢linux的原因,比较短 ...

  3. linux常用命令汇总

    linux常用命令汇总,以便需要时快速查询 中文释义 相应命令 备注 在文件中查找 grep error catalina.out 在catalina.out文件中查找error信息 重启nginx ...

  4. Linux常用命令大全-toolfk程序员在线工具网

    本文要推荐的[ToolFk]是一款程序员经常使用的线上免费测试工具箱,ToolFk 特色是专注于程序员日常的开发工具,不用安装任何软件,只要把内容贴上按一个执行按钮,就能获取到想要的内容结果.Tool ...

  5. LINUX常用命令(基础)

    LINUX常用命令(基础) 收藏LINUX常用命令(基础) 1. man 对你熟悉或不熟悉的命令提供帮助解释eg:man ls 就可以查看ls相关的用法注:按q键或者ctrl+c退出,在linux下可 ...

  6. DOS 和 Linux 常用命令的对比

    此为转载文章,转自:http://www.huihoo.org/gnu_linux/ch-doslinux.html Red Hat Linux 9: Red Hat Linux 入门指南 后退 前进 ...

  7. Linux常用命令(echo、date、ls、cd、history、cat)

    一.linux常用命令有很多今天我们来总结一下常用的入门命令: 1.linux下关机命令:poweroff.init 0.halt.shutdown -h now 2.linux下重启命令:reboo ...

  8. Linux初学者接住了---Linux常用命令

    前言 本文整理了Linux常用命令,分类整理,举例说明使用方法,希望为大家带来便利.命令严格区分大小写,一般是小写,tab键补全. Linux常用命令 前言 一.文件处理命令 1.命令格式 目录处理命 ...

  9. Linux 常用命令笔记

    Linux 常用命令笔记 1. locate locate:用来定位文件的位置,如:locate a.txt 但是这个命令有延迟,也就是新建的文件不一定能搜索到,如果非要找到新建的文件可以使用 upd ...

最新文章

  1. Adam那么棒,为什么还对SGD念念不忘 (3)—— 优化算法的选择与使用策略
  2. 使用git更新github上的开源项目
  3. kotlin 查找id_Kotlin程序查找矩阵的转置
  4. 2019文献汇总 | 单细胞与病毒感染
  5. IT 趣味故事:TCP 出“大事”了!
  6. AtCoder Beginner Contest 137 解题报告(A ~ E)
  7. charset参数 sqluldr2_sqluldr2使用几例
  8. 蓝牙协议分析工具Wireshark/Frontline/Ellisys的使用
  9. android flutter教程,Android开发 学习Flutter 入门
  10. JS高级---函数中的this的指向,函数的不同调用方式
  11. LeetCode 1128.等价多米诺骨牌
  12. 增加点赞手势图及提交按钮图标
  13. 选择背光需要对比哪些因素呢?
  14. 基于STM32设计的遥控小车(手机APP+GPS+温湿度+ESP8266)
  15. 微服务开源生态报告 No.1
  16. visio消除直线连接圆弧
  17. 三相电开水器的工作原理及接法
  18. 2022年密码测评理论与关键技术前沿论坛|海泰方圆分享密码应用改造典型方案
  19. PowerBuilder 自动注册ODBC
  20. 【Python训练营】Python每日一练----第9天:七段码

热门文章

  1. 程序员最不喜欢的酒店房号是什么?打死你都猜不到!
  2. 下载java哪个版本_学习JAVA应该下载ORACLE哪个版本
  3. 什么叫侧面指纹识别_侧面指纹VS屏下指纹和后置指纹,原来我们都低估了侧面指纹...
  4. DB2: not logged initially append on
  5. 多智能体系统协同一致性问题(一)
  6. java如何将字符串写入到txt文件中,值得收藏!
  7. 机器学习算法 综述(入门)
  8. windows7与linux共存,windows7和linux可以并存吗?
  9. 弱监督语义分割论文方法分类
  10. 2022.01.20 - 214.石子游戏 IX