查看“Alpine”的源代码
←
Alpine
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
=NOTE= 一般一个软件官方用什么os作容器就用他,不一定是alpine才是最好的 例如 mysql python就可能不是 https://www.armbian.com/ [https://cloud.tencent.com/developer/article/1632733 不要轻易使用 Alpine 镜像来构建 Docker 镜像,有坑!] [https://www.infoq.cn/article/VODLe9FsiBkQdlcxJZZj 用Alpine会让Python Docker的构建慢50倍] =see also= [[Alpine 修改docker的时区及安装telnet]] =alpine lnmp 也为docker准备 = [https://www.jianshu.com/p/41ac6157c5fc alpine apk lNMP安装部署] [https://wiki.alpinelinux.org/wiki/Production_LAMP_system:_Lighttpd_%2B_PHP_%2B_MySQL#Installation Production LAMP system: Lighttpd + PHP + MySQL] [https://wiki.alpinelinux.org/wiki/Nginx_with_PHP#Nginx_with_PHP7 alpine lnmp] [https://www.cyberciti.biz/faq/how-to-install-php-7-fpm-on-alpine-linux/ How to install PHP 7 fpm on Alpine Linux] =pre= 占用内存仅仅 37M ,非常的小巧。适合用在树莓派或者其他低内存设备上。 [https://liyin.date/2017/03/18/alpine-linux-setup/index.html Alpine Linux 折腾记] =修改 源 为cst 中国标准时间= <pre> #修改源 cat /etc/apk/repositories echo 'https://mirrors.ustc.edu.cn/alpine/v3.14/main https://mirrors.ustc.edu.cn/alpine/v3.14/community'>/etc/apk/repositories http://mirrors.aliyun.com/alpine/v3.12/main http://mirrors.aliyun.com/alpine/v3.12/community echo 'http://mirrors.aliyun.com/alpine/v3.14/main http://mirrors.aliyun.com/alpine/v3.14/community' >/etc/apk/repositories apk add --update nodejs npm #RUN 表明 这是在容器里面的 RUN apk add -U tzdata #设置时区 RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ && echo 'Asia/Shanghai' >/etc/timezone </pre> =download = ==x86== https://alpinelinux.org/downloads/ https://mirrors.aliyun.com/alpine/v3.10/releases/x86_64/alpine-standard-3.10.3-x86_64.iso http://dl-cdn.alpinelinux.org/alpine/v3.10/releases/x86_64/alpine-standard-3.10.1-x86_64.iso ==Raspberry Pi== AArch64是ARMv8 架构的一种执行状态 so 下载这个 拿回来试一下 http://mirrors.ustc.edu.cn/alpine/v3.8/releases/aarch64/alpine-rpi-3.8.1-aarch64.tar.gz http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/aarch64/alpine-rpi-3.8.1-aarch64.tar.gz http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/armhf/alpine-rpi-3.8.1-armhf.tar.gz 国内的mirrors 有时比较同步比较慢 https://mirrors.alpinelinux.org/ ===install on pi=== [https://wiki.alpinelinux.org/wiki/Classic_install_or_sys_mode_on_Raspberry_Pi 要看 ] https://wiki.alpinelinux.org/wiki/Raspberry_Pi [https://wiki.alpinelinux.org/wiki/Create_a_Bootable_USB Create a Bootable USB] https://my.oschina.net/u/2306127/blog/1587585 https://wiki.alpinelinux.org/wiki/Create_a_Bootable_USB [https://xts.so/linux/install-the-alpine-linux-on-raspberry-pi-zero-w.html 在树莓派Zero W上安装alpine linux系统] =安装过程= 输入root 没有密码 直接回车 如果是内网机器 记得打开 root login ssh 13-选择 sys 方式使用磁盘,将系统安装到本地硬盘-格式化硬盘-完成硬盘安装 sys [https://blog.csdn.net/CSDN_duomaomao/article/details/76053229 Alpine linux硬盘安装] =configure= <pre> 国内源 a. 编辑 /etc/apk/repositories b. 将里面 dl-cdn.alpinelinux.org 的 改成 mirrors.aliyun.com ; 保存退出即可 非交互 echo 'http://mirrors.aliyun.com/alpine/v3.14/main http://mirrors.aliyun.com/alpine/v3.14/community' >/etc/apk/repositories apk add --update nodejs npm cat /etc/apk/repositories #/media/cdrom/apks http://mirrors.aliyun.com/alpine/v3.10/main http://mirrors.aliyun.com/alpine/v3.10/community #http://mirror.xtom.com.hk/alpine/v3.10/main #http://mirror.xtom.com.hk/alpine/v3.10/community #http://mirror.xtom.com.hk/alpine/edge/main #http://mirror.xtom.com.hk/alpine/edge/community #http://mirror.xtom.com.hk/alpine/edge/testing apk update alpine:~# cat /etc/apk/repositories #/media/cdrom/apks http://mirrors.ustc.edu.cn/alpine/v3.8/main http://mirrors.ustc.edu.cn/alpine/v3.8/community cp /etc/apk/repositories /etc/apk/repositories.bak </pre> =软件包管理工具apk的基本使用= <pre> 可以方便地安装、删除、更新软件。 #查询openssh相关的软件包 apk search openssh #安装一个软件包 apk add xxx #删除已安装的xxx软件包 apk del xxx #获取更多apk包管理的命令参数 apk --help #比如安装常用的网络相关工具: #更新软件包索引文件 apk update #用于文本方式查看网页,用于测试http协议 apk add curl #提供了查看网络连接的协议端口的命令ss,可以替代netstat命令 apk add iproute2 #drill 命令可以替代dig和nslookup DNS查询命令 apk add drill alpine:~# df -h Filesystem Size Used Available Use% Mounted on devtmpfs 10.0M 0 10.0M 0% /dev shm 245.0M 0 245.0M 0% /dev/shm /dev/sda3 29.4G 576.7M 27.3G 2% / tmpfs 49.0M 108.0K 48.9M 0% /run /dev/sda1 92.8M 19.1M 66.8M 22% /boot </pre> =Alpine Linux 包管理= <pre> 5.apk info $ apk info #列出所有已安装的软件包 $ apk info -a zlib #显示完整的软件包信息 $ apk info --who-owns /sbin/lbu #显示指定文件属于的包 </pre> =on vps = my.vultr.com ISO Library has apline 3.8 也可以自己上传 [https://wiki.alpinelinux.org/wiki/Bootstrapping_Alpine_Linux Bootstrapping Alpine Linux - Alpine Linux] [https://discuss.vultr.com/discussion/1033/custom-iso-alpinelinux custom-iso-alpinelinux] [https://www.linode.com/docs/tools-reference/custom-kernels-distros/install-alpine-linux-on-your-linode/ Install Alpine Linux on your Linode] =docker= <pre> cat /etc/apk/repositories http://mirrors.aliyun.com/alpine/v3.10/main http://mirrors.aliyun.com/alpine/v3.10/community echo 'http://mirrors.aliyun.com/alpine/v3.18/main http://mirrors.aliyun.com/alpine/v3.18/community' >/etc/apk/repositories apk add openjdk8 apk add maven apk add docker rc-update add docker boot service docker start apk add py-pip apk add python-dev libffi-dev openssl-dev gcc libc-dev make mkdir -p ~/.pip #vim ~/.pip/pip.conf cat >>~/.pip/pip.conf<<EOF [global] index-url = http://mirrors.aliyun.com/pypi/simple/ [install] trusted-host=mirrors.aliyun.com EOF pip install more-itertools==5.0.0 #3.10.3 pip install docker-compose #err 100% |████████████████████████████████| 81kB 1.2MB/s more-itertools requires Python '>=3.5' but the running Python is 2.7.16 </pre> ==nodejs yarn etc== <pre> #换源 然后 apk add --no-cache nodejs yarn python </pre> https://wiki.alpinelinux.org/wiki/Docker =alpine docker php= github 有个php-worker 搞了一关的 可以参考 [https://blog.csdn.net/liyyzz33/article/details/97265262 Alpine安装php各种扩展] [https://blog.csdn.net/u010953609/article/details/89309712 Dockerfile 学习:Docker Alpine PHP 安装扩展] [https://blog.csdn.net/qw_xingzhe/article/details/80161109 docker官方alpine/php镜像下安装php扩展] [http://www.zzfly.net/alpine-linux-php-mysql/ Alpine Linux 初上手与安装 PHP7 / MySQL 环境] =trouble shooting= ==alpine镜像crontab无法运行问题 == <pre> alpine镜像 普通用户 crontab无法运行问题 crond 服务用 root用户启动 or on ci docker-compose exec -u root -T php-worker sh -c "crond" 如果用官方提供alpine镜像是不自动启动crond的,得手动起 每个用户有单独的文件在/etc/crontabs文件夹 可以用supervisor启动crond,但要用root用户去启动crond,运行其他用户的定时任务 cron itself should run as root, regardless of which user you want to use to run the jobs. This will install a crontab for user robuser. When cron executes jobs from this particular crontab, it will automatically switch users to robuser. However, cron can’t switch users like that if it’s not running as root, which is why you need to be running cron as root. crontab -l crontab: must be suid to work properly apk add --update busybox-suid </pre> [https://blog.csdn.net/gsying1474/article/details/68946455 alpine linux中如何使用crontab执行定时任务] [https://stackoverflow.com/questions/36453787/failed-to-edit-crontab-linux-alpine Failed to edit crontab (linux Alpine)] [https://blog.csdn.net/weixin_43086579/article/details/84901497?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase Alpine容器启动Crontab任务] [https://devopsheaven.com/cron/docker/alpine/linux/2017/10/30/run-cron-docker-alpine.html Running cron jobs in a Docker Alpine container] =ops= [[Alpine 修改docker的时区及安装telnet]] <pre> apk add rsync </pre> =install golnag= <pre> #1.16 的,新的可能要下载的安装方式 apk add --no-cache git make musl-dev go </pre> https://stackoverflow.com/questions/52056387/how-to-install-go-in-alpine-linux =install nginx = <pre> nstall the prerequisites: sudo apk add openssl curl ca-certificates To set up the apk repository for stable nginx packages, run the following command: printf "%s%s%s%s\n" \ "@nginx " \ "http://nginx.org/packages/alpine/v" \ `egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release` \ "/main" \ | sudo tee -a /etc/apk/repositories Next, import an official nginx signing key so apk could verify the packages authenticity. Fetch the key: curl -o /tmp/nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub Verify that downloaded file contains the proper key: openssl rsa -pubin -in /tmp/nginx_signing.rsa.pub -text -noout The output should contain the following modulus: Public-Key: (2048 bit) Modulus: 00:fe:14:f6:0a:1a:b8:86:19:fe:cd:ab:02:9f:58: 2f:37:70:15:74:d6:06:9b:81:55:90:99:96:cc:70: 5c:de:5b:e8:4c:b2:0c:47:5b:a8:a2:98:3d:11:b1: f6:7d:a0:46:df:24:23:c6:d0:24:52:67:ba:69:ab: 9a:4a:6a:66:2c:db:e1:09:f1:0d:b2:b0:e1:47:1f: 0a:46:ac:0d:82:f3:3c:8d:02:ce:08:43:19:d9:64: 86:c4:4e:07:12:c0:5b:43:ba:7d:17:8a:a3:f0:3d: 98:32:b9:75:66:f4:f0:1b:2d:94:5b:7c:1c:e6:f3: 04:7f:dd:25:b2:82:a6:41:04:b7:50:93:94:c4:7c: 34:7e:12:7c:bf:33:54:55:47:8c:42:94:40:8e:34: 5f:54:04:1d:9e:8c:57:48:d4:b0:f8:e4:03:db:3f: 68:6c:37:fa:62:14:1c:94:d6:de:f2:2b:68:29:17: 24:6d:f7:b5:b3:18:79:fd:31:5e:7f:4c:be:c0:99: 13:cc:e2:97:2b:dc:96:9c:9a:d0:a7:c5:77:82:67: c9:cb:a9:e7:68:4a:e1:c5:ba:1c:32:0e:79:40:6e: ef:08:d7:a3:b9:5d:1a:df:ce:1a:c7:44:91:4c:d4: 99:c8:88:69:b3:66:2e:b3:06:f1:f4:22:d7:f2:5f: ab:6d Exponent: 65537 (0x10001) Finally, move the key to apk trusted keys storage: sudo mv /tmp/nginx_signing.rsa.pub /etc/apk/keys/ To install nginx, run the following command: sudo apk add nginx@nginx The @nginx tag should also be specified when installing packages with dynamic modules: sudo apk add nginx-module-image-filter@nginx nginx-module-njs@nginx </pre> http://nginx.org/en/linux_packages.html#Alpine =python= [https://blog.csdn.net/Kernel_Heart/article/details/107808949 alpine linux 安裝python指定版本以及pip] =desktop= 暂时没有中文输入法 [https://www.cnblogs.com/jinzhenshui/p/8418281.html Alpine Linux:如何配置GUI的图形桌面环境:x Desktop Environment] [https://blog.csdn.net/weixin_30590285/article/details/95415847 Alpine Linux:如何配置GUI的图形桌面环境:x Desktop Environment] [https://wiki.alpinelinux.org/wiki/MATE MATE 桌面] [https://wiki.alpinelinux.org/wiki/Awesome(wm)_Setup Awesome桌面] [https://liyin.date/2017/03/18/alpine-linux-setup/ 折腾记] [https://icoolworld.github.io/alpine/alpine-%E4%B8%AD%E6%96%87%E6%88%AA%E5%9B%BE%E4%B9%B1%E7%A0%81%E9%97%AE%E9%A2%98.html alpine-中文截图乱码问题] =问题= Alpine Linux使用了musl,可能和其他Linux发行版使用的glibc实现会有所不同。在容器化中最可能遇到的是DNS问题,即musl实现的DNS服务不会使用resolv.conf文件中的search和domain两个配置,这对于一些通过DNS来进行服务发现的框架可能会遇到问题 [https://www.wencst.com/2017/11/23/docker-alpine%E7%89%88%E6%9C%AC%E6%9C%8D%E5%8A%A1%E4%B8%AD%E6%98%BE%E7%A4%BA%E4%B8%AD%E6%96%87/ docker alpine版本服务中显示中文] =see also= [https://blog.csdn.net/diyiday/article/details/91439151 alpine之创建最小docker镜像] [https://www.cnblogs.com/jackadam/p/9290366.html Alpine Linux常用命令] [https://blog.csdn.net/CSDN_duomaomao/article/details/76053229 Alpine linux硬盘安装] [https://blog.csdn.net/CSDN_duomaomao/article/details/76152416 Alpine Linux 使用] [http://mirrors.ustc.edu.cn/help/alpine.html Alpine Linux 源使用帮助] [http://www.10tiao.com/html/357/201702/2247484888/1.html Alpine Linux配置使用技巧] [http://blog.csdn.net/csdn_duomaomao/article/details/76053229 Alpine linux硬盘安装] [https://zh.wikipedia.org/wiki/BusyBox BusyBox] ==Raspberry Pi== [https://a-delacruz.github.io/alpine/alpine-linux.html Raspberry Pi 3 Alpine Linux arm64] [https://wiki.alpinelinux.org/wiki/Raspberry_Pi Raspberry Pi] ==other== [https://blog.csdn.net/diyiday/article/details/78332924 alpine linux填坑之路安装php-bcmath] [https://blog.csdn.net/freewebsys/article/details/53816615 docker(13):alpinelinux安装jenkins] [http://www.infoq.com/cn/news/2016/01/Alpine-Linux-5M-Docker Alpine Linux,一个只有5M的Docker镜像] [https://www.cnblogs.com/xy14/p/11980272.html Python - 安装 - 在 Alpine Linux 下安装 Python2 ] [[category:ops]]
返回至
Alpine
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
我的导航
关于我
shell
python
ops
linuxchina.net
blog.linuxchina
最近更改
随机页面
帮助
工具
链入页面
相关更改
特殊页面
页面信息