deepin的安装与开发环境配置

deepin 下载安装

官网下在镜像:https://www.deepin.org,把镜像解压后里面有u盘启动盘制作工具,使用U盘一键安装。

用硬盘安装总是出现各种各样的问题,而且没有交换空间,会比较卡。

开发环境搭建

配置 oh my zsh

安装zsh

1
2
sudo apt-get install zsh
chsh -s /bin/zsh # 设置zsh为默认shell

安装oh my zsh

1
2
sudo apt-get install git
sudo sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

配置主题

1
2
3
4
5
6
# 修改 theme 为 agnoster 并保存
vim ~/.zshrc
# 安装 powerline 字体
git clone https://github.com/powerline/fonts
cd fonts
./install.sh

将终端字体设置为powerline字体就可以看到效果了。

配置插件

1
2
# 安装 zsh-autosuggestion 插件
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

插件配置

1
2
3
4
5
plugins: (
git
z
zsh-autosuggestion
)

NodeJs MongoDB 环境

1
2
3
4
5
6
sudo su
apt-get udpate
apt-get install nodejs
apt-get install npm
apt-get install mongondb
npm install -g cnpm --registry=https://registry.npm.taobao.org

如果按照cnpm报错,可以先运行一下命令

1
2
3
npm set registry https://registry.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像
npm cache clean # 清空缓存

PHP Nginx Mysql 环境

1
2
3
4
5
sudo su
apt-get install nginx
apt-get install mysql
apt-get install php7.0
apt-get install php7.0-fpm

配置nginx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
server_name _;

location / {
index index.htm index.html index.php;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}

location ~ \.php$ {
root /var/www/html; #指定php的根目录
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

安装php扩展示例,如使用mysqli则安装对应的包

1
sudo apt-get install php-mysql

开放端口

1
sudo /sbin/iptables -I INPUT -p tcp --dport 4396 -j ACCEPT
Partager