一、克隆存儲庫
下載git并分別在終端運(yùn)行以下命令克隆四個項目到你選擇的文件夾中,例如~/qcadoo/:
git clone git@github.com:qcadoo/qcadoo-super-pom-open
git clone git@github.com:qcadoo/qcadoo-maven-plugin
git clone git@github.com:qcadoo/qcadoo
git clone git@github.com:qcadoo/mes
(提示:若運(yùn)行命令后克隆速度過慢可選擇在碼云平臺上下載以上四個項目,鏈接分別為:
1.https://github.com/qcadoo/qcadoo-super-pom-open
2.https://github.com/qcadoo/qcadoo-maven-plugin
3.https://github.com/qcadoo/qcadoo
4.https://github.com/qcadoo/mes)
二、配置數(shù)據(jù)庫
1.安裝數(shù)據(jù)庫
在終端上用apt命令安裝postgressql數(shù)據(jù)庫,依次運(yùn)行以下命令:
sudo apt-get update
sudo apt-get intsall postgresql
最后用psql --version命令查看psql出現(xiàn)版本號即表明安裝成功,如下圖所示:

2.修改數(shù)據(jù)庫用戶密碼并創(chuàng)建mes數(shù)據(jù)庫
在Deepin下安裝Postgresql后,會自動添加一個名為postgres的操作系統(tǒng)用戶,密碼是隨機(jī)的。并且會自動生成一個名字為postgres的數(shù)據(jù)庫,用戶名也為postgres,密碼也是隨機(jī)的。根據(jù)項目文檔需要把數(shù)據(jù)庫用戶為postgres的密碼改成“postgres123”并創(chuàng)建mes數(shù)據(jù)庫,依次運(yùn)行以下命令:
sudo -u postgres psql //使用postgres 用戶登錄
postgres=# ALTER ROLE postgres WITH PASSWORD 'postgres123'; //PostgreSQL下的命令提示符,注意最后有分號
CREATE DATABASE mes; //創(chuàng)建名為mes的數(shù)據(jù)庫
最后輸入\q命令即可退出。
三、打包下載的四個項目
1.按以下順序進(jìn)入對應(yīng)目錄執(zhí)行以下命令(切記一定要按順序來):
a.qcadoo-super-pom-open
b.qcadoo-maven-plugin
c.qcadoo //運(yùn)行到此步可能出現(xiàn)錯誤
d.mes
mvn clean install
(注意:如果在第三步運(yùn)行命令時出現(xiàn)Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test的錯誤則在該項目目錄下的pom文件加下面這一塊:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
)
四、將相關(guān)表導(dǎo)入mes數(shù)據(jù)庫(mes數(shù)據(jù)庫已在上面第二大步中創(chuàng)建)并建立應(yīng)用程序:
1.在mes數(shù)據(jù)庫中導(dǎo)入表
終端進(jìn)入postgres安裝目錄的bin文件夾下執(zhí)行以下命令:
psql -h localhost -U postgres -d mes -f /root/qcadoo/mes/mes-application/src/main/resources/schema/demo_db_en.sql
///root/qcadoo/mes/mes-application/src/main/resources/schema/demo_db_en.sql是你自己電腦下載的qcadoo項目目錄下對應(yīng)的demo_db_en.sql路徑,根據(jù)實際情況更改
接著會自動進(jìn)行導(dǎo)入,導(dǎo)入完成后可運(yùn)行以下命令進(jìn)入mes數(shù)據(jù)庫查看對應(yīng)表:
sudo -u postgres psql
postgres=# \c mes //進(jìn)入mes數(shù)據(jù)庫
mes=# \d //查看mes中的表
接著會出現(xiàn)如下表:

最后輸入wq即可退出。
2.建立MES應(yīng)用程序
終端進(jìn)入mes/mes-application目錄并運(yùn)行以下命令:
mvn clean install -o -Ptomcat -Dprofile=package //如果失敗則把-o去掉再試一次
五、啟動MES
終端進(jìn)入mes/mes-application/target/tomcat-archiver/mes-application目錄并執(zhí)行以下命令:
chmod a+x bin/*.sh //賦予tomcat腳本執(zhí)行權(quán)限
接著啟動MES:
./bin/startup.sh

啟動成功后通過http://你的IP:8080/login.html?lang=cn訪問MES:

通過默認(rèn)賬號和密碼為admin來登錄即可。
關(guān)機(jī)MES:
./bin/shutdown.sh
