返回 AI 资讯
社区讨论LinuxDo 最新

记一次Ubuntu服务器开荒

首先登录服务器,然后更改root密码(不好记) passwd 安装zsh apt update apt install zsh curl git 一键安装脚本 sh -c "$(curl -fsSL https://gitee.com/jinzcdev/ohmyzsh-with-plugins/raw/main/install ohmyzsh.sh)" 设立su用户 创建用户 mubai,自动创建家目录和 bash shell sudo adduser mubai 加入 sudo 组(推荐,Ubuntu 标准做法…

内容摘要

作者:#烁 板块:#资源荟萃 首先登录服务器,然后更改root密码(不好记) passwd 安装zsh apt update apt install zsh curl git # 一键安装脚本 sh -c "$(curl -fsSL https://gitee.com/jinzcdev/ohmyzsh-with-plugins/raw/main/install_ohmyzsh.sh)" 设立su用户 # 创建用户 mubai,自动创建家目录和 bash shell sudo adduser mubai # 加入 sudo 组(推荐,Ubuntu 标准做法) sudo usermod -aG sudo mubai # 查看用户信息和所属组 id mubai # 切换到 mubai 测试 sudo su - mubai sudo whoami # 输入 mubai14506,输出 root 即成功 本地生成密钥对,启用SSH密钥连接 # windows PowerShell ssh -V ssh-keygen -t ed25519 -C "your_email@example.com" # PowerShell命令 type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh 用户名@服务器IP "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys" 使用创建的su用户登录进行配置 # omz一键安装脚本 sh -c "$(curl -fsSL https://gitee.com/jinzcdev/ohmyzsh-with-plugins/raw/main/install_ohmyzsh.sh)" # brew安装 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # brew依赖安装 sudo apt install build-essential procps curl file git -y # brew写进PATH echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.zshrc eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" # p10k主题配置 brew install romkatv/powerlevel10k/powerlevel10k echo "source $(brew --prefix)/opt/powerlevel10k/share/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc 安装Miniconda # 确认系统架构 uname -m # x86_64 架构(最常见的 Intel/AMD 64位) wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh # 如果是 ARM64(例如树莓派、Apple Silicon 虚拟机、AWS Graviton) wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh # 运行安装脚本 bash Miniconda3-latest-Linux-x86_64.sh # 用完整路径执行 conda init,让它写进 ~/.zshrc ~/miniconda3/bin/conda init zsh # 重启zsh exec zsh 安装nvm & npm # 安装nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash # 生效并安装node.js source ~/.zshrc # 安装最新 LTS 版本(目前是 22 系列,也可指定版本号如 nvm install 20) nvm install --lts # 验证 node -v npm -v 安装Docker # Add Docker's official GPG key: sudo apt update sudo apt install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: sudo tee /etc/apt/sources.list.d/docker.sources <<EOF Types: deb URIs: https://download.docker.com/linux/ubuntu Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") Components: stable Architectures: $(dpkg --print-architecture) Signed-By: /etc/apt/keyrings/docker.asc EOF sudo apt update # 安装Docker包 sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin # 检查Docker是否在运行 sudo systemctl status docker # 如果不在运行 sudo systemctl start docker # 验证命令 sudo docker run hello-world 安装资源监控btop GitHub - aristocratos/btop: A monitor of resources · GitHub sudo apt install btop

资讯来源

LinuxDo

原文链接

打开原文