Ubuntu服务器部署
Ubuntu服务器部署
1. 开发环境配置
1.1 Python/Python3安装
- python3 install
ubuntu14.04 升级python3.4到3.6
Ubuntu 16.04 安装 python3.6 环境并设置为默认
- pip
1 | 1. 更新系统包 |
- pip version >= 10
ImportError: cannot import name ‘main‘
1 | cd /usr/bin |
create the repository directory for git
1 | mkdir projectGitlab/ |
1.3 ubuntu安装常用数据库(mongoDB, mysql)
1.3.1 mysql for ubuntu
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
sudo netstat -tap | grep mysql
msyql -u root -p
show database
show tables
mysql数据库使用root账号创建新用户
# -- 创建用户设置
create user 'chaininfo_dev'@'%' identified by 'chaininfo_dev';
# -- 创建数据库
create database database_chain_news DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
# -- 为用户赋权限
grant all privileges on database_chain_news.* to 'chaininfo_dev'@'%' identified by 'chaininfo_dev';
grant all privileges on database_chain_news.* to 'chaininfo_dev'@'localhost' identified by 'chaininfo_dev';
flush privileges;
1.3.2 mongodb for ubuntu install
sudo apt-get install mongodb
(install no response input before the line above :
sudo apt-get update
)
# check the mongodb is start or not
gprep mongo -l
# where the directory is the mongo location
locate mongo
# mongodb uninstall
sudo apt-get --purge remove mongodb mongodb-clients mongodb-server
mongodb start and stop
# start sudo systemctl start mongodb # stop sudo systemctl stop mongodb
mongodb install error
(全球初始化失败:BadValue无效或没有用户语言环境设置。请确保LANG and/or LC_ 正确设置环境变量)*
解决方法
方法一: 手动设置变量,只是临时有用,重启后就没用了,需要在环境变量配置文件添加一行。
sudo vim /etc/profile export LC_ALL=C
方法二: 手动更改源环境
sudo vim /etc/default/locale LANG="en_US.UTF-8" LANGUAGE="en_US:en" LC_ALL="en_US.UTF-8"
1.4 Scrapy install
1 | dependency lib |
- UserWarning: You do not have a working installation of the service_identity module: ‘cannot import name ‘opentype’’.
1 | pip3 install --user service_identity --force --upgrade |
- error: Failed building wheel for twisted
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24sudo apt update
sudo apt install python3.6-dev
```
* [add-apt-repositoryModuleNotFoundError: No module named 'apt_pkg'](https://qiita.com/miyagaw61/items/665616d769f74158f1a1)
**Traceback (most recent call last):
File "/usr/bin/apt-add-repository", line 11, in <module>
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'**
```shell
cd /usr/lib/python3/dist-packages
sudo ln -s apt_pkg.cpython-{35m,36m}-x86_64-linux-gnu.so
```
## 1.4 scrapyd 部署
## 1.5 java项目部署
### 1.5.1 安装JDK8
[INSTALL ORACLE JAVA8/jdk8 IN UBUNTU OR LINUX MINT VIA PPA REPOSITORY](http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html)
```shell
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
1.5.2 安装Tomcat8
Install Tomcat 8 on ubuntu 16.04 Server
1.5 mongodb 添加远程访问配置
Ubuntu的add-apt-repository: command not found
1 | sudo apt-get install software-properties-common python-software-properties |
Ubuntu环境下python配置
完全卸载python for Ubuntu 14.04
Python3以上版本安装sqlite3的解决方案
Python3安装sqlite3
Ubuntu中Python3找不到_sqlite3模块
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Qin Blog!