天天看點

java開源psi,centos7搭建開源ERP-PSI

1、介紹及環境需求

1、介紹:PSI是一款基于SaaS模式(Software as a Service軟體即服務)的企業管理軟體。PSI以商貿企業的核心業務:采購、銷售、庫存(進銷存)為切入點,最終目标是行業化的ERP解決方案。

2、PSI支援多種安裝方式可以在windows或者linux上進行安裝,本文隻介紹在centos7下的安裝(因為現實情況不可能一台伺服器隻跑一個網站,而且後期管理也很繁瑣)。其它平台及環境(包括一鍵安裝包請檢視其在碼雲上托管文檔https://gitee.com/crm8000/PSI/tree/master/doc/04 安裝)

3、基本軟體:

作業系統:centos7系列

PHP版本:7+

資料庫:MySQL5.5+及MariaDB

Nginx:系統自帶版本即可

2、關于Nginx和PHP安裝

1、安裝Nginx:

請先安裝擴充源:yum -y install epel-*

yum -y install nginx

安裝完成,由于是yum安裝,安裝檔案及配置檔案在/etc/nginx目錄下

useradd www -d /data/www/ -m

初始化nginx配置檔案

cd /etc/nginx

cp nginx.conf.default    nginx.conf

編輯nginx.conf

需修改内容已加粗

include /usr/share/nginx/modules/*.conf;

events {

worker_connections 1024;

}

http {

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/nginx/access.log  main;

sendfile            on;

tcp_nopush          on;

tcp_nodelay        on;

keepalive_timeout  65;

types_hash_max_size 2048;

include            /etc/nginx/mime.types;

default_type        application/octet-stream;

include /etc/nginx/conf.d/*.conf;

server {

listen      80 default_server;

listen      [::]:80 default_server;

server_name localhost;      //修改服務的主機名

root /data/www;      //更改服務讀取目錄

# Load configuration files for the default server block.

include /etc/nginx/default.d/*.conf;

location / {

}

error_page 404 /404.html;

location = /40x.html {

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

}

}

}

在conf.d目錄下vim建立虛拟主機配置檔案

server

{

listen 8001;

server_name crm;

index index.php index.html index.htm;

root  /data/www/psi;

client_body_buffer_size 1m;

client_body_temp_path /data/tmp/nginx;

client_max_body_size 10m;

location ~ /\.

{

deny all;

}

location / {

if (!-e $request_filename){

rewrite ^/web/(.*)$ /web/index.php/$1 last;  #--關鍵的配置,支援ThinkPHP的rewrite支援

}

}

location ~ .*\.php {  #--經測試,必須以去除?$結尾,去掉$是為了不比對行末,即可以比對.php/,以實作pathinfo

fastcgi_pass  127.0.0.1:9000;

fastcgi_index index.php;

include fastcgi.conf;

include pathinfo.conf;  #--關鍵的配置,支援ThinkPHP的pathinfo支援

}

access_log test.psi.com_access.log main;

error_log test.psi.com_error.log;

}

上部分内容使用include引入了pathinfo.conf,是以我們需要在nginx主目錄vim建立這個檔案

set $real_script_name $fastcgi_script_name;

if ($fastcgi_script_name ~ "(.+?\.php)(/.*)") {

set $real_script_name $1;

set $path_info $2;

}

fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;

fastcgi_param SCRIPT_NAME $real_script_name;

fastcgi_param PATH_INFO $path_info;

2、安裝php 7.2.12

前往PHP官網(http://php.net/get/php-7.2.12.tar.gz/from/a/mirror)點選下圖圈中内容進行下載下傳

java開源psi,centos7搭建開源ERP-PSI

下載下傳頁面

上傳到伺服器相關位置并解壓

tar xf php-7.2.12.tar.gz

cd php-7.2.12

yum 安裝相關依賴

yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers gmp gmplib gmp-devel libmcrypt libmcrypt-devel readline readline-devel

其中會有幾個提示找不到相關資源,請自行百度查找并進行安裝,可以進行編譯安裝。

./configure --prefix=/usr/local/php7 --enable-fpm --enable-soap --with-xmlrpc --with-openssl --with-mcrypt --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-pdo --with-pdo-mysql --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --with-libxml-dir

make && make install

find . -name "php.ini*"

cp php.ini-production /usr/local/php7/lib/php.ini

find . -name "php-fpm*"

cp ./sapi/fpm/php-fpm.service /etc/systemd/system/

cd /usr/local/php7/etc/php-fpm.d/

cp www.conf.default www.conf

systemctl start php-fpm

systemctl enable php-fpm

3、部署PSI

前往碼雲下載下傳(需注冊或者登陸才可以下載下傳)

java開源psi,centos7搭建開源ERP-PSI

下載下傳頁面

上傳并解壓,拷貝到 /data/www/psi

平滑重新開機nginx:systemctl reload nginx

4、導入資料庫

進入如下目錄

java開源psi,centos7搭建開源ERP-PSI

資料庫檔案

-建立資料庫 建立庫名為psi,字元集為utf8的庫,授權psier使用者來登入,密碼為abcd.1234

mysql -u root -p

create database psi character set utf8;

grant all on psi.* to 'psier'@'localhost' identified by 'abcd.1234';

exit

導入初始化資料庫資料

導入表結構:mysql -upsier -h127.0.0.1 -pabcd.1234 psi 

導入初始化資料:mysql -upsier -h127.0.0.1 -pabcd.1234 psi 

導入測試資料(這一步可選,我沒有導入):mysql -upsier -h127.0.0.1 -pabcd.1234 psi 

修改配置檔案的資料庫連接配接

vim /data/www/psi/web/Application/Common/Conf/config.php

java開源psi,centos7搭建開源ERP-PSI

修改配置檔案的資料庫連接配接

systemctl reload nginx

之後使用ip+端口的方式進行通路,預設使用者名密碼都是admin

使用方式請參照下圖

java開源psi,centos7搭建開源ERP-PSI

幫助