一个简单的ubuntu/开发板初始化脚本

创建一个脚本,用于安装必要组件和docker。以下是针对nano pi M1,使用的是H3芯片,因此docker用的源是arch=armhf,需要根据需求进行修改

bash 复制代码
#!/bin/bash

# 1. Update the system
sudo apt-get update && sudo apt-get upgrade -y

# 2. Install pip2 and pip3
sudo apt-get install python-pip python3-pip -y

# 3. Install Docker
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=armhf] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce -y

# Set Docker to start on boot
sudo systemctl enable docker
sudo systemctl start docker

# docker compose
sudo apt-get install libffi-dev libssl-dev -y
sudo apt-get install -y python3 python3-pip -y
sudo apt-get remove python-configparser -y
sudo pip3 install docker-compose

# 4. Install Portainer
docker volume create portainer_data
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

# 5. Install other common tools
sudo apt-get install -y git vim htop net-tools

echo "Setup complete!"
相关推荐
Christal_pyy4 小时前
树莓派4基于Debian GNU/Linux 12 (Bookworm)添加多个静态ipv4网络
linux·网络·debian
csbDD5 小时前
2025年网络安全(黑客技术)三个月自学手册
linux·网络·python·安全·web安全
李狗蛋儿啊5 小时前
zero自动化框架搭建---Git安装详解
运维·git·自动化
小金的学习笔记5 小时前
如何在本地和服务器新建mysql用户和密码
运维·服务器·mysql
s_fox_6 小时前
nginx ngx_http_module(7) 指令详解
运维·nginx·http
EasyNVR6 小时前
EasyRTC智能硬件:实时畅联、沉浸互动、消音护航
运维·服务器·网络·安全·音视频·webrtc·p2p
CarryBest6 小时前
Jenkins 环境搭建---基于 Docker
运维·jenkins
若云止水7 小时前
Ubuntu 下 nginx-1.24.0 源码分析 - ngx_process_options
运维·nginx
s_fox_7 小时前
nginx ngx_http_module(9) 指令详解
运维·nginx·http
Natsuagin7 小时前
轻松美化双系统启动界面与同步时间设置(Windows + Ubuntu)
linux·windows·ubuntu·grub