linux开发基本配置:ubuntu配置
一、安装ubuntu
1、安装VMware,可以自行网上搜软件,这里提供一个下载资源VMware
 2、可以自行网上下载ubuntu,也可以使用这里提供的ubuntu操作系统,提供ubuntu16的桌面版和服务器版操作系统:
 链接:https://pan.baidu.com/s/1IY2hCWSwqGH-hdHdK1gJmg
 提取码:q43w
 安装过程:嫌麻烦的,可以直接选择典型,这里就按典型安装过程示意
 
 这里选择ubuntu镜像文件的路径
 
 这里是ubuntu的个性名(即登录界面的名字),系统的用户名、密码
 
 这里分别是VMware的上该虚拟机的名字和虚拟机的地址
 
 这里推荐至少30G,下面选择拆分成多个文件
 
 配置完成后启动虚拟机,等待系统安装完成
二、ubuntu环境配置
1、更新源和软件
sudo apt-get update
 
sudo apt-get upgrade
 
如果update更新较慢,因为ubuntu默认源是国外的,如果想更快,可以选择国内的镜像源
 阿里源地址:https://developer.aliyun.com/mirror/ubuntu
 配置方法:
 本文提供的ubuntu没有编辑,先安装vim,后续可以用的上,vim的简单使用可以自行百度
sudo apt-get install vim
 
输入命令,可以查看到该目录有一个文件sources.list
ls /etc/apt/
 
cp sources.list sources.list.old //备份
sudo vim sources.list //编辑该文件
 
替换默认的
 http://archive.ubuntu.com/ 为 mirrors.aliyun.com
 本文提供系统可以使用如下的源,注释原来的,复制如下内容到文件,保存即可,之后更新源。
deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe
 
2、开启ssh
安装ssh服务端
sudo apt-get install openssh-server
 
确认ssh服务已经启动
ps -e | grep ssh
 
如果只有ssh-agent那ssh-server还没有启动,需要/etc/init.d/ssh start,如果看到
3、samba配置
- 安装samba是为了可以在win下通过共享的方式访问linux文件
 
sudo apt-get install samba
 
- 查看是否安装成功
 
samba
 
- 可以先在个人目录下创建过一个共享文件夹
 
mkdir /home/test/share
 
修改权限
chmod 777 share
 
- 配置samba,编辑samba的配置文件
 
sudo vim /etc/samba/samba.conf
 
- 在文件末尾添加如下格式的内容
 
[temp]              <==共享资源名称
        comment = Temporary file space <==简单的解释,内容无关紧要
        path = /home/test/share     <==实际的共享目录
        writable = yes    <==设置为可写入
        browseable = yes   <==可以被所有用户浏览到资源名称
 
- 添加用户并设置密码
设置账号用于登录samba服务器,并设置密码 
smbpasswd -a test
New SMB password:
Retype new SMB password:
 
- 重启Samba服务器
 
samba /etc/init.d/smb restart
 
- 查看ubuntu的ip地址
 
ifconfig
 
- windows下登录samba

在图中输入ubuntu的ip地址:\xxx.xxx.xxx.xxx
右键选择出现的目录,选择映射网络驱动器,输入samba的账号密码,即可像本地磁盘一样访问文件了 
4、安装gcc
sudo apt-get install build-essential
gcc –verision //查看安装的gcc版本
 
安装多个版本的gcc:
sudo apt-get install gcc-9 g++-9
sudo apt-get install gcc-7 g++-7
 
//如果按照高版本的gcc失败,可能是系统不支持,就需要安装高版本的操作系统,比如ubuntu20等。
切换默认的gcc编译器
ls  /usr/bin/gcc*  //查看安装了那些gcc
sudo update-alternatives  --install  /usr/bin/gcc gcc /usr/bin/gcc-9 50
sudo update-alternatives  --install  /usr/bin/gcc gcc /usr/bin/gcc-7 40
sudo update-alternatives --config gcc
 
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).
Selection    Path            Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gcc-9   50        auto mode
  1            /usr/bin/gcc-7   40        manual mode
  2            /usr/bin/gcc-9   50        manual mode
 
维持当前值[*]请按回车键,或者键入选择的编号,切换默认gcc
 gcc –verison//可以查看,此时已经切换成功
按照同样的方式配置g++
三、便捷工具推荐
这里有一些个人觉得比较好用的工具推荐,可以提高开发效率,并提供了下载链接
 大家有好用的工具,也可以推荐
1、xshell, 用于远程连接liunx
 2、putty,用于远程连接liunx
 链接:https://pan.baidu.com/s/1a0uvwTJJacS1dcfCuW1fBA
 提取码:alg6
 3、winscp,用于win和linux之间互相传输文件,支持拖拽形式
 链接:https://pan.baidu.com/s/1uFNhrXyGC77l_9udzKIJUQ
 提取码:6idu
 4、Beyond Compare 用于比较文件差异,二进制,十六进制,文本、文件夹等待,支持编辑修改
 5、everything, 快速搜索文件工具
 6、Typora, 类似word,一个轻量级写文档,记笔记的工具










