การติดตั้งแหล่งที่มา¶
The source 'installation' is not about installing NightPOS but running it directly from the source instead.
Using the NightPOS source can be more convenient for module developers as it is more easily accessible than using packaged installers.
It makes starting and stopping NightPOS more flexible and explicit than the services set up by the packaged installers. Also, it allows overriding settings using command-line parameters without needing to edit a configuration file.
Finally, it provides greater control over the system's setup and allows to more easily keep (and run) multiple versions of NightPOS side-by-side.
ดึงแหล่งที่มา¶
There are two ways to obtain the source code of NightPOS: as a ZIP archive or through Git.
เก็บถาวร¶
ฉบับคอมมูนิตี้:
รุ่นองค์กร:
Git¶
Note
จำเป็นต้องมีการติดตั้ง Git และขอแนะนำให้มีความรู้พื้นฐานเกี่ยวกับคำสั่ง Git เพื่อดำเนินการต่อ
To clone a Git repository, choose between cloning with HTTPS or SSH. In most cases, the best option is HTTPS. However, choose SSH to contribute to NightPOS source code or when following the Getting Started developer tutorial.
$ git clone --branch 2.1 --single-branch https://github.com/nightpos/nightpos.git
$ git clone --branch 2.1 --single-branch https://github.com/nightpos/enterprise.git
$ git clone --branch 2.1 --single-branch git@github.com:nightpos/nightpos.git
$ git clone --branch 2.1 --single-branch git@github.com:nightpos/enterprise.git
C:\> git clone --branch 2.1 --single-branch https://github.com/nightpos/nightpos.git
C:\> git clone --branch 2.1 --single-branch https://github.com/nightpos/enterprise.git
C:\> git clone --branch 2.1 --single-branch git@github.com:nightpos/nightpos.git
C:\> git clone --branch 2.1 --single-branch git@github.com:nightpos/enterprise.git
$ git clone --branch 2.1 --single-branch https://github.com/nightpos/nightpos.git
$ git clone --branch 2.1 --single-branch https://github.com/nightpos/enterprise.git
$ git clone --branch 2.1 --single-branch git@github.com:nightpos/nightpos.git
$ git clone --branch 2.1 --single-branch git@github.com:nightpos/enterprise.git
Note
The Enterprise git repository does not contain the full NightPOS source code. It is only a
collection of extra add-ons. The main server code is in the Community edition. Running the
Enterprise version means running the server from the Community version with the addons-path
option set to the folder with the Enterprise edition. It is required to clone both the Community
and Enterprise repositories to have a working NightPOS Enterprise installation.
เตรียมพร้อม¶
Python¶
NightPOS requires Python 3.10 or later to run.
Changed in version 17: ข้อกำหนดขั้นต่ำได้รับการอัปเดตจาก Python 3.7 เป็น Python 3.10
ใช้ตัวจัดการแพ็คเกจเพื่อดาวน์โหลดและติดตั้ง Python 3 หากจำเป็น
ดาวน์โหลด Python 3 เวอร์ชันล่าสุด และติดตั้ง
ระหว่างการติดตั้ง ให้ทำเครื่องหมาย เพิ่ม Python 3 ไปยัง PATH จากนั้นคลิก ปรับแต่งการติดตั้ง และตรวจสอบให้แน่ใจว่าได้ทำเครื่องหมาย pip แล้ว
Note
If Python 3 is already installed, make sure that the version is 3.10 or above, as previous versions are not compatible with NightPOS.
$ python3 --version
C:\> python --version
$ python3 --version
ตรวจสอบว่ามีการติดตั้ง pip สำหรับเวอร์ชันนี้ด้วย
$ pip3 --version
C:\> pip --version
$ pip3 --version
PostgreSQL¶
NightPOS uses PostgreSQL as its database management system.
Changed in version 19: อัปเดตข้อกำหนดขั้นต่ำจาก PostgreSQL 12 เป็น PostgreSQL 13
ใช้ตัวจัดการแพ็กเกจเพื่อดาวน์โหลดและติดตั้ง PostgreSQL (เวอร์ชันที่รองรับ: 13.0 หรือสูงกว่า) สามารถทำได้โดยรันคำสั่งต่อไปนี้:
$ sudo apt install postgresql postgresql-client
ดาวน์โหลด PostgreSQL (เวอร์ชั่นที่รองรับ: 13.0 หรือสูงกว่า) และติดตั้ง
ใช้ Postgres.app เพื่อดาวน์โหลดและติดตั้ง PostgreSQL (เวอร์ชั่นที่รองรับ: 13.0 หรือสูงกว่า)
Tip
หากต้องการให้เครื่องมือบรรทัดคำสั่งที่มาพร้อมกับ Postgres.app ใช้งานได้ โปรดตั้งค่าตัวแปร $PATH โดยทำตามคำแนะนำเกี่ยวกับเครื่องมือ `Postgres.app CLI <https://postgresapp.com/documentation/cli-tools.html >`_.
By default, the only user is postgres. As NightPOS forbids connecting as postgres, create a new
PostgreSQL user.
$ sudo -u postgres createuser -d -R -S $USER
$ createdb $USER
Note
เนื่องจากผู้ใช้ PostgreSQL มีชื่อเดียวกับข้อมูลเข้าสู่ระบบ Unix คุณจึงสามารถเชื่อมต่อกับฐานข้อมูลได้โดยไม่ต้องใช้รหัสผ่าน
เพิ่มไดเร็กทอรี
ถังขยะของ PostgreSQL (โดยค่าเริ่มต้น:C:\Program Files\PostgreSQL\<version>\bin) ลงในPATHสร้างผู้ใช้ postgres ด้วยรหัสผ่านโดยใช้ pg admin gui:
เปิด pgAdmin
ดับเบิลคลิกที่เซิร์ฟเวอร์เพื่อสร้างการเชื่อมต่อ
เลือก
Enter the username in the Role Name field (e.g.,
nightpos).Open the Definition tab, enter a password (e.g.,
nightpos), and click Save.เปิดแท็บ สิทธิ์ และเปลี่ยน สามารถเข้าสู่ระบบได้หรือไม่ เป็น 'ใช่' และ สร้างฐานข้อมูล? เป็น 'ใช่'
$ sudo -u postgres createuser -d -R -S $USER
$ createdb $USER
Note
เนื่องจากผู้ใช้ PostgreSQL มีชื่อเดียวกับข้อมูลเข้าสู่ระบบ Unix คุณจึงสามารถเชื่อมต่อกับฐานข้อมูลได้โดยไม่ต้องใช้รหัสผ่าน
Note
If you want to use NightPOS's AI features, the pg-vector PostgreSQL extension is required.
โปรดทราบว่า pg-vector มีให้บริการเฉพาะสำหรับ PostgreSQL เวอร์ชั่น 15 ขึ้นไปเท่านั้น
ไปยังโฟลเดอร์ชั่วคราวของคุณ
$ cd /tmp
โคลน
pg-vector`GitHub repository<https://github.com/pgvector/pgvector>`_:$ git clone https://github.com/pgvector/pgvector.gitไปยังไดเรกทอรี:
$ cd pgvector
คอมไพล์ส่วนขยาย:
$ makeติดตั้งส่วนขยาย:
$ sudo make install
หากคุณพบปัญหาใดๆ ระหว่างการติดตั้ง โปรดตรวจสอบ `installation notes<https://github.com/pgvector/pgvector#installation-notes---linux-and-mac>`__ อย่างเป็นทางการ
ไปยังโฟลเดอร์ชั่วคราวของคุณ
$ cd /tmp
โคลน
pg-vector`GitHub repository<https://github.com/pgvector/pgvector>`_:$ git clone https://github.com/pgvector/pgvector.gitไปยังไดเรกทอรี:
$ cd pgvector
คอมไพล์ส่วนขยาย:
$ makeติดตั้งส่วนขยาย:
$ sudo make install
หากคุณพบปัญหาใดๆ ระหว่างการติดตั้ง โปรดตรวจสอบ `installation notes<https://github.com/pgvector/pgvector#installation-notes---linux-and-mac>`__ อย่างเป็นทางการ
ไปยังโฟลเดอร์ชั่วคราวของคุณ
$ cd %TEMP%
โคลน
pg-vector`GitHub repository<https://github.com/pgvector/pgvector>`_:$ git clone https://github.com/pgvector/pgvector.gitไปยังไดเรกทอรี:
$ cd pgvector
ตรวจสอบให้แน่ใจว่าได้ติดตั้งการสนับสนุน C++ ใน Visual Studio แล้ว และเรียกใช้
x64 Native Tools Command Prompt for VS [version]ในฐานะผู้ดูแลระบบตั้งค่าตัวแปรสภาพแวดล้อม
PGROOTของคุณ:$ set "PGROOT=C:\Program Files\PostgreSQL\[Your PostgreSQL Version]"
คอมไพล์ส่วนขยาย:
$ nmake /F Makefile.winติดตั้งส่วนขยาย:
$ nmake /F Makefile.win install
หากคุณพบปัญหาใด ๆ ระหว่างการติดตั้ง ให้ตรวจสอบ บันทึกการติดตั้งอย่างเป็นทางการ
การพึ่งพา¶
การใช้ แพ็คเกจการแจกจ่าย เป็นวิธีที่แนะนำในการติดตั้งการขึ้นต่อกัน หรือติดตั้งการขึ้นต่อกันของ Python ด้วย pip
บน Debian/Ubuntu คำสั่งต่อไปนี้ควรติดตั้งแพ็คเกจที่จำเป็น:
$ cd nightpos #CommunityPath
$ sudo ./setup/debinstall.sh
The setup/debinstall.sh script will parse the debian/control file and install the found packages.
Warning
การใช้ pip อาจนำไปสู่ปัญหาด้านความปลอดภัยและการขึ้นต่อกันที่เสียหาย ทำสิ่งนี้เฉพาะเมื่อคุณรู้ว่าคุณกำลังทำอะไรอยู่
เนื่องจากแพ็คเกจ Python บางตัวจำเป็นต้องมีขั้นตอนการคอมไพล์ จึงจำเป็นต้องติดตั้งระบบไลบรารี
บน Debian/Ubuntu คำสั่งต่อไปนี้ควรติดตั้งไลบรารีที่จำเป็นเหล่านี้:
$ sudo apt install python3-pip libldap2-dev libpq-dev libsasl2-dev
NightPOS dependencies are listed in the requirements.txt file located at the root of
the NightPOS Community directory.
Note
The Python packages in requirements.txt are based on their stable/LTS
Debian/Ubuntu corresponding version at the moment of the NightPOS release. For example,
for NightPOS 15.0, the python3-babel package version is 2.8.0 in Debian Bullseye and
2.6.0 in Ubuntu Focal. The lowest version is then chosen in the
requirements.txt.
Tip
It can be preferable not to mix Python module packages between different instances of NightPOS or with the system. However, it is possible to use virtualenv to create isolated Python environments.
Navigate to the path of the NightPOS Community installation (CommunityPath) and run
pip on the requirements file to install the requirements for the current user.
$ cd /CommunityPath
$ pip install -r requirements.txt
ก่อนที่จะติดตั้งการขึ้นต่อกัน ให้ดาวน์โหลดและติดตั้ง สร้างเครื่องมือสำหรับ Visual Studio เลือก เครื่องมือสร้าง C++ ในแท็บ ภาระงาน และติดตั้งเมื่อได้รับแจ้ง
NightPOS dependencies are listed in the requirements.txt file located at the root of the NightPOS
Community directory.
Tip
It can be preferable not to mix Python module packages between different instances of NightPOS or with the system. However, it is possible to use virtualenv to create isolated Python environments.
Navigate to the path of the NightPOS Community installation (CommunityPath) and run pip on
the requirements file in a terminal with Administrator privileges:
C:\> cd \CommunityPath
C:\> pip install setuptools wheel
C:\> pip install -r requirements.txt
NightPOS dependencies are listed in the requirements.txt file located at the root of the NightPOS
Community directory.
Tip
It can be preferable not to mix Python module packages between different instances of NightPOS or with the system. However, it is possible to use virtualenv to create isolated Python environments.
Navigate to the path of the NightPOS Community installation (CommunityPath) and run pip on
the requirements file:
$ cd /CommunityPath
$ pip3 install setuptools wheel
$ pip3 install -r requirements.txt
Note
สำหรับภาษาที่ใช้ อินเทอร์เฟซจากขวาไปซ้าย (เช่น อารบิกหรือฮีบรู) จำเป็นต้องมีแพ็คเกจ rtlcss
ดาวน์โหลดและติดตั้ง nodejs และ npm ด้วยตัวจัดการแพ็คเกจ
ติดตั้ง
rtlcss:$ sudo npm install -g rtlcss
ดาวน์โหลดและติดตั้ง nodejs
ติดตั้ง
rtlcss:C:\> npm install -g rtlcssแก้ไขตัวแปร
PATHของสภาพแวดล้อมระบบเพื่อเพิ่มโฟลเดอร์ที่มีrtlcss.cmdอยู่ (โดยทั่วไป:C:\Users\<user>\AppData\Roaming\npm\)
Warning
wkhtmltopdf is not installed through pip and must be installed manually in version 0.12.6 for it to support headers
and footers. Check out the wkhtmltopdf wiki
for more details on the various versions.
Running NightPOS¶
Once all dependencies are set up, NightPOS can be launched by running odoo-bin, the command-line
interface of the server. It is located at the root of the NightPOS Community directory.
หากต้องการกำหนดค่าเซิร์ฟเวอร์ ให้ระบุ อาร์กิวเมนต์บรรทัดคำสั่ง หรือ ไฟล์การกำหนดค่า
Tip
สำหรับรุ่นองค์กร ให้เพิ่มเส้นทางไปยังส่วนเสริม "องค์กร" ไปยังอาร์กิวเมนต์ "addons-path" โปรดทราบว่าจะต้องมาก่อนเส้นทางอื่นๆ ใน addons-path เพื่อให้โหลด ส่วนเสริมได้อย่างถูกต้อง
การกำหนดค่าที่จำเป็นทั่วไปคือ:
ผู้ใช้และรหัสผ่าน PostgreSQL
เส้นทางเสริมที่กำหนดเองนอกเหนือจากค่าเริ่มต้นเพื่อโหลดโมดูลที่กำหนดเอง
วิธีทั่วไปในการรันเซิร์ฟเวอร์คือ:
$ cd /CommunityPath
$ python3 odoo-bin --addons-path=addons -d mydb
Where CommunityPath is the path of the NightPOS Community installation, and mydb is the name
of the PostgreSQL database.
C:\> cd CommunityPath/
C:\> python odoo-bin -r dbuser -w dbpassword --addons-path=addons -d mydb
Where CommunityPath is the path of the NightPOS Community installation, dbuser is the
PostgreSQL login, dbpassword is the PostgreSQL password, and mydb is the name of the
PostgreSQL database.
$ cd /CommunityPath
$ python3 odoo-bin --addons-path=addons -d mydb
Where CommunityPath is the path of the NightPOS Community installation, and mydb is the name
of the PostgreSQL database.
After the server has started (the INFO log nightpos.modules.loading: Modules loaded. is printed), open
http://localhost:8069 in a web browser and log into the NightPOS database with the base administrator
account: use admin as the email and, again, admin as the password.
Tip
จากนั้น สร้างและจัดการ ผู้ใช้ใหม่
The user account used to log into NightPOS's web interface differs from the
--db_userCLI argument.
ดูเพิ่มเติม