新买的阿里云学生服务器debian8.9配置 Apare_xzc

debian配置

2021.7.8


首先我们去阿里云的官网买了一个学生服务器,如下图,我们可以选择地区,系统镜像还有配置。我选择的是debian8.9 2核2G,CentOS作为服务器也很稳定其实。

在这里插入图片描述
购买成功后我们可以看到服务器镜像的 内网地址,外网地址和其它配置信息,方便和安全起见,可以重置密码。
在这里插入图片描述
默认是root, 我们只需要在自己的cmd(或者mac的终端,或者linux的终端) ssh root@内网地址 就可以远程登陆了。
在这里插入图片描述

一、先看一下基本环境

  1. 查看系统架构:
# uname -a
Linux iZ2ze61irhf5hpew9xk18eZ 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u3 (2017-08-15) x86_64 GNU/Linux

# dpkg --print-architecture
amd64

# getconf LONG_BIT
64
# arch
x86_64
  1. GCC版本:
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.2 (Debian 4.9.2-10)

在这里插入图片描述
支持C++11
在这里插入图片描述
支持C++14
在这里插入图片描述
不支持C++17


  1. Python版本
# python --version
Python 2.7.9
# python3 --version
-bash: python3: command not found

  1. (没有预装java和go)

二、简单配置vim

# cd /usr/share/vim/ && ls
addons  registry  vim74  vimfiles  vimrc  vimrc.tiny
# cat vimrc
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
" the call to :runtime you can find below.  If you wish to change any of those
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
" will be overwritten everytime an upgrade of the vim packages is performed.
" It is recommended to make changes after sourcing debian.vim since it alters
" the value of the 'compatible' option.

" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim

" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
"syntax on

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark

" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
"  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif

" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
"  filetype plugin indent on
"endif

" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd            " Show (partial) command in status line.
"set showmatch          " Show matching brackets.
"set ignorecase         " Do case insensitive matching
"set smartcase          " Do smart case matching
"set incsearch          " Incremental search
"set autowrite          " Automatically save before commands like :next and :make
"set hidden             " Hide buffers when they are abandoned
"set mouse=a            " Enable mouse usage (all modes)


syntax on "开启语法高亮
set showcmd " 命令模式下,在底部显示,当前键入的指
set mouse=a " 支持使用鼠标
set encoding=utf-8
set t_Co=256 " 开启256色
set autoindent " 按下回车键后,下一行的缩进会自动跟上一行的缩进保持一致
set tabstop=4 " Tab键的空格数
set expandtab " Tab自动转化为空格
set softtabstop=4 " Tab转化为多少个空格
set number " 显示行号
set cursorline " 光标所在当前行高亮
set showmatch " 光标在括号上时,自动高亮对应匹配的括号
set matchtime=2            " 短暂跳转到匹配括号的时间
set hlsearch " 搜索时高亮显示匹配结果
inoremap ( ()<LEFT>
inoremap { {}<LEFT>
inoremap [ []<LEFT>

" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif

三、简单配置bashrc

因为我是root,所以都直接配置全局的好了

# vim /etc/bash.bashrc

# root @ iZ2ze61irhf5hpew9xk18eZ /etc [00:39:56]
# tail -3 /etc/bash.bashrc
alias ls='ls --color'
alias ll='ls -l --color'
PS1="\n\[$(tput sgr0)\]\[\033[38;5;11m\]\\$\[$(tput sgr0)\] \[$(tput sgr0)\]\[\033[38;5;51m\]\u\[$(tput sgr0)\] \[$(tput sgr0)\]\[\033[38;5;253m\]@\[$(tput sgr0)\] \[$(tput sgr0)\]\[\033[38;5;2m\]\H\[$(tput sgr0)\] \[$(tput sgr0)\]\[\033[38;5;226m\]\w\[$(tput sgr0)\] \[$(tput sgr0)\]\[\033[38;5;250m\][\t]\[$(tput sgr0)\]\n\[$(tput sgr0)\]\[\033[38;5;196m\]\\$\[$(tput sgr0)\] \[$(tput sgr0)\]"
# source /etc/bash.bashrc

四、生成ssh-key

在这里插入图片描述
我们用ssh-keygen -t rsa命令生成公钥和私钥,可以在 ~/.ssh目录中查看。然后将id_rsa.pub的内容添加到自己github的ssh列表中即可。

五、安装git

发现没有预装git

sudo apt-get update
sudo apt-get install git-core

设置username和email
在这里插入图片描述
用ssh从我的github中随便拉一个项目到本地服务器
在这里插入图片描述


// todo

六、安装Golang环境

  1. https://golang.google.cn/dl/下载源码并解压到/usr/local
 wget https://golang.google.cn/dl/go1.16.5.linux-amd64.tar.gz  #根据操作系统的系统架构和要安装golang的版本选择合适的版本进行下载
 tar -C /usr/local/ -xzf go1.16.5.linux-amd64.tar.gz

在这里插入图片描述
2. 将/usr/local/go/bin加入到系统环境变量

#可以直接在bash终端中敲,但是建议写入某个bashrc文件比如/etc/bash.bashrc,这样的话每次远程登录都会自动把这个路径加入环境变量中
export PATH=$PATH:/usr/local/go/bin

在这里插入图片描述
在这里插入图片描述
GOROOT是go的安装目录,一般为/usr/local/go,GOPATH是工作目录,一般为~/go

我们去 $HOME目录下去创建 go/src  go/pkg 和 go/bin
cd
mkdir -p go/src
mkdir -p go/pkg
mkdir -p go/bin

简单测试一下,没有什么问题
在这里插入图片描述


七、安装一些常用的工具:

如tree, curl, wget

apt-get install tree
# ls
go  go1.16.5.linux-amd64.tar.gz  MyCpp

# root @ iZ2ze61irhf5hpew9xk18eZ ~ [16:43:55]
# tree go
go
├── bin
├── pkg
└── src
    └── hello
        ├── helloworld
        └── helloworld.go

4 directories, 2 files

八、安装MySQL

debian系统安装mysql直接apt-get install即可

apt-get install mysql-server mysql-client

期间会弹出一个对话框设置本地mysql root用户的密码,然后就可以用设置的密码登录了
在这里插入图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
您好!要在阿里云服务器上安装 Docker,您可以按照以下步骤进行操作: 1. 登录到您的阿里云服务器。可以使用 SSH 客户端,如 PuTTY。 2. 更新服务器上的软件包列表,以确保获取最新的软件包信息。运行以下命令: ``` sudo apt update ``` 3. 安装必要的依赖包,以使 apt 能够通过 HTTPS 使用存储库。运行以下命令: ``` sudo apt install apt-transport-https ca-certificates curl software-properties-common ``` 4. 添加 Docker 的官方 GPG 密钥。运行以下命令: ``` curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg ``` 5. 添加 Docker 的稳定存储库。运行以下命令: ``` echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ``` 6. 更新软件包列表以包括 Docker 存储库。运行以下命令: ``` sudo apt update ``` 7. 安装 Docker CE(社区版)。运行以下命令: ``` sudo apt install docker-ce docker-ce-cli containerd.io ``` 8. 安装完成后,Docker 服务将自动启动。您可以通过运行以下命令来检查 Docker 是否已成功安装: ``` sudo docker run hello-world ``` 如果您看到类似于 "Hello from Docker!" 的输出,那么恭喜您,Docker 已成功安装在您的阿里云服务器上! 希望这能帮助到您!如有任何问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值