Alpine Linux 是一个社区开发的面向安全应用的轻量级Linux发行版。

适合用来做Docker镜像、路由器、防火墙、VPNs、VoIP 盒子 以及服务器的操作系统,基于uClibc 和 Busybox。

一: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 更新索引以生效。

4.我的配置:

打开/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  #删除一个软件

8.安装一个本地 未认证 的apk包

apk add --allow-untrusted test.apk

四: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 简介(面向安全应用的发行版)apk相关推荐

  1. alpine linux 简介

    alpine linux系统操作 文章目录 1.alpine linux 简介 2.alpine国内源 3.包管理 3.1包管理器 3.2apk update 3.3apk search 3.4apk ...

  2. 加速规模装机,HiHopeOS面向金融行业的软件发行版通过OpenHarmony兼容性测评

    近日,润和软件HiHopeOS面向金融行业的软件发行版通过OpenAtom OpenHarmony(简称"OpenHarmony")V3.1 Release版本兼容性测评,为Ope ...

  3. Linux搭建虚拟专用,Ubuntu的发行版如何搭建虚拟专用网

    是通过因特网上将局域网扩展到远程网络和远程计算机用户的一种成本效益极佳的办法.那么Ubuntu的发行版如何搭建虚拟专用网呢?下面学习啦小编就为大家带来了Ubuntu发行版搭建虚拟专用网的方法. Ubu ...

  4. puppy linux 版本,Puppy Linux 8.0 发布,轻量级发行版

    Puppy Linux项目生成了一个轻量级的发行版,其中包含许多图形工具,只需一个小小的下载.该项目的最新版本是Puppy Linux 8.0 "BionicPup". findn ...

  5. linux 容器与外部网络_Linux发行版仍然与容器相关吗?

    linux 容器与外部网络 有人说Linux发行版不再与容器有关. 诸如一次性容器和临时容器之类的替代方法似乎风行一时. 似乎我们正在考虑和做出技术决策时更多地基于时尚感和即时的情感满足,而不是通过选 ...

  6. redhat7 linux内核版本,CentOS和Redhat发行版linux内核版本的对应关系

    由于Redhat和CentOS的发行版本现在众多,所以我们应该知道CentOS和Redhat及linux内核之间版本的对应关系对维护系统还是很有帮助的.对应的列表如下: Redhat 9.0----- ...

  7. Docker微容器之Alpine Linux 初体验

    0x00 前言 Alpine Linux是一个面向安全的轻型的Linux发行版,基于Alpine Linux的超小型Docker镜像,大小只有5MB,并且可以访问比其他基于BusyBox的镜像更完整的 ...

  8. Alpine Linux(初)

    文章目录 1.Alpine Linux 特点: - 小 - - 简单 - - 安全 - 2.Alpine包管理工具 apk 3.Alpine+Docker Alpine Linux是一个基于安全的轻量 ...

  9. alpine linux系统操作

    alpine linux系统操作 文章目录 alpine linux系统操作 一.Alpine Linux 简介 二.apline 国内镜像源 三.包管理 3.1包管理器 3.2apk update ...

最新文章

  1. 报错You may use special comments to disable some warnings.vue-cli脚手架关闭eslint的步骤
  2. 在家远程办公,如何才能让员工高效工作?
  3. 仿真环境跟车2分钟,就让自动驾驶系统撞上马路牙子,攻破率超90%,多传感器融合系统都失效...
  4. QUESTION-PRINCIPLE-ANSWER(SOLUTION) RELATIONSHIP
  5. Nginx不停机优雅升级
  6. caffeine 时间轮的实现
  7. .net 反编译_向.net/Unity 程序员推荐一个十分因吹斯听的网站:sharplab.io
  8. 不是每个人的一生都会有贵人相助
  9. 第六章节 三层架构(一. 三层架构的概述)
  10. 驱动设计ARM(6410)-按键驱动0基础知识点
  11. (day 45 - 中序遍历 ) 剑指 Offer 54. 二叉搜索树的第k大节点
  12. 使用Android Studio向SVN上传新项目
  13. 腾讯翻译君在线翻译怎么翻译整个文件_7款好用的英文翻译软件推荐
  14. IIS 热启动设置的方法
  15. 提高效率的十款Blender快捷键,更多快捷键等着你去探索
  16. 探索第二个合数世纪C语言,第一单元 探索计算机的奥秘
  17. Google正式收购SketchUp
  18. 49个excel常用技巧(一)
  19. VUE三目运算使用 :style与:class
  20. 深度卷积网络:第二课

热门文章

  1. print格式化输出,以及使用format控制
  2. 2018-2019-1 20165201 《信息安全系统设计基础》第6周学习总结
  3. 『中级篇』docker之wordpress容器SSL(番外篇)(78)
  4. Jsp 无法解析${}
  5. 微信小程序教学第三章第四节(含视频):小程序中级实战教程:下拉更新、分享、阅读标识...
  6. 数字证书应用综合揭秘(包括证书生成、加密、解密、签名、验签)
  7. [git/svn]Git和SVN差异
  8. 解决 DNS general: warning: *** POKED TIMER ***
  9. 创建字符设备的三种方法
  10. ORACLE nvarchar2和varchar2的区别