ubuntu开发环境

系统下载安装

1、安装VirtualBox或者VMWare
2、前往http://releases.ubuntu.com/或者镜像网站下载对应版本的iso文件
3、安装ubuntu

VirtualBox设置共享文件夹

1、启动ubuntu,在VirtualBox设备菜单中安装增强功能,运行
2、VirtualBox添加一个固定分配的共享文件夹share,不要选择自动挂载
3、创建挂载目录sudo mkdir /mnt/share
4、在/etc/fstab中添加一项share /mnt/share vboxsf defaults 0 0
5、重启后,df -h看一下share是不是已经挂载到/mnt/share了

常用命令

sysinfo

uname -a

cat /proc/version
cat /proc/cpuinfo
cat /proc/meminfo

cat /etc/environment
cat /etc/passwd
cat /etc/shells

env
fdisk -l
df -h
free -h
ps aux
pstree
top
ifconfig
netstat -atnp
vmstat

account

passwd root

groupadd hw
useradd hw -g hw -G sudo -m -s /bin/bash
passwd hw
su hw

apt

sudo cp /etc/apt/sources.list /etc/apt/souces.list.bak
vi /etc/apt/souces.list

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

sudo apt-get update

devenv

sudo apt-get install build-essential autoconf automake libtool

sudo apt-get install git
git config --global user.name "XXX"
git config --global user.email "XXX"
git config --global core.editor editor  

apt-get install python
apt-get install python-pip

editor

sudo apt-get install vim ctags cscope
git clone https://github.com/ithewei/vimrc.git ~/.vim # 我自己的vim配置 or
git clone https://gitee.com/ithewei/vimrc.git ~/.vim # 国内gitee更快
cd ~/.vim
./install.sh
vim
:PluginInstall

add-apt-repository ppa:adrozdoff/emacs
apt-get install emacs25
git clone https://github.com/purcell/emacs.d.git ~/.emacs.d # 拷贝大牛的配置

sudo ln -sf /usr/bin/vim /etc/alternatives/editor

中文输入法

sudo apt-get install ibus-pinyin
ibus-setup添加中文拼音输入
系统设置中添加输入法,并设置切换键位为Ctrl-Space
ibus-daemon -drx

locale

locale
sudo vi /etc/default/locale
LANG="en_US.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
# 格式
# en_US.UTF-8
# language_COUNTRY.charmaps

ss

sudo pip install shadowsocks
# shadowsocks.json
{
    "server":"0.0.0.0",
    "server_port":8388,
    "password":"readsense",
    "local_address":"127.0.0.1",
    "local_port":1080,
    "timeout":500,
    "method":"aes-256-cfb",
    "fast_open":false
} 
server:
ssserver -c /etc/shadowsocks.json -d start
client:
sslocal  -c /etc/shadowsocks.json -d start
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'

LAMP/LNMP

sudo add-apt-repository ppa:ondrej/php
sudo apt-get install apache2 nginx mysql-server mysql-client php7.0

x86
64位系统上运行32位二进制程序,需额外安装32位运行环境

sudo apt-get install libc6-i386 lib32stdc++6 lib32z1 lib32tinfo5 lib32ncurses5

clang

sudo apt-get install llvm clang clang-format

mingw

sudo apt-get install mingw-w64

# mingw Thread model: posix | win32
sudo update-alternatives --config i686-w64-mingw32-gcc
sudo update-alternatives --config i686-w64-mingw32-g++
sudo update-alternatives --config x86_64-w64-mingw32-gcc
sudo update-alternatives --config x86_64-w64-mingw32-g++

golang

wget https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz
sudo tar -xzf go1.13.5.linux-amd64.tar.gz -C /opt
cd /opt
sudo mv go go1.13.5

export GOROOT=/opt/go1.13.5
export GOPATH=~/golang
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

zlib

git clone https://gitee.com/mirrors/zlib
cd zlib
./configure && make && sudo make install

openssl

git clone https://gitee.com/mirrors/openssl
cd openssl
git checkout OpenSSL_1_1_1d
./config && make && sudo make install

curl

git clone https://gitee.com/mirrors/curl
cd curl
git checkout curl-7_67_0
./autoconf && ./configure && make && sudo make install

cmake

gitt clone https://gitee.com/mirrors/cmake
cd cmake
git checkout v3.16.0
./bootstrap && make && sudo make install

nginx

wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
tar -xzf pcre-8.43.tar.gz
cd pcre-8.43
./configure && make && sudo make install

git clone https://gitee.com/mirrors/nginx
git checkout release-1.16.0
auto/configure --with-http_ssl_module --with-http_v2_module
make && sudo make install

如需静态链接pcre、ssl、z库,修改objs/Makefile文件中链接库方式

Wl,-Bstatic -lpcre -lssl -lcrypto -lz \
Wl,-Bdynamic -ldl -lpthread -lcrypt \
Wl,-E

redis

git clone https://gitee.com/mirrors/redis.git
cd redis
git checkout 5.0.0
make && sudo make install
sudo cp redis.conf /etc/
cd deps/hiredis
sudo make install

leveldb

git clone https://gitee.com/mirrors/leveldb.git
cd leveldb
git checkout 1.22
mkdir -p build/linux-x86_64
cd build/linux-x86_64
cmake ../..
make
发布了128 篇原创文章 · 获赞 142 · 访问量 28万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 代码科技 设计师: Amelia_0503

分享到微信朋友圈

×

扫一扫,手机浏览