การติดตั้งแหล่งที่มา

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

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 หากจำเป็น

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

ตรวจสอบว่ามีการติดตั้ง pip สำหรับเวอร์ชันนี้ด้วย

$ 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

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 คุณจึงสามารถเชื่อมต่อกับฐานข้อมูลได้โดยไม่ต้องใช้รหัสผ่าน

Note

If you want to use NightPOS's AI features, the pg-vector PostgreSQL extension is required.

โปรดทราบว่า pg-vector มีให้บริการเฉพาะสำหรับ PostgreSQL เวอร์ชั่น 15 ขึ้นไปเท่านั้น

  1. ไปยังโฟลเดอร์ชั่วคราวของคุณ

    $ cd /tmp
    
  2. โคลน pg-vector `GitHub repository<https://github.com/pgvector/pgvector>`_:

    $ git clone https://github.com/pgvector/pgvector.git
    
  3. ไปยังไดเรกทอรี:

    $ cd pgvector
    
  4. คอมไพล์ส่วนขยาย:

    $ make
    
  5. ติดตั้งส่วนขยาย:

    $ sudo make install
    

หากคุณพบปัญหาใดๆ ระหว่างการติดตั้ง โปรดตรวจสอบ `installation notes<https://github.com/pgvector/pgvector#installation-notes---linux-and-mac>`__ อย่างเป็นทางการ

การพึ่งพา

การใช้ แพ็คเกจการแจกจ่าย เป็นวิธีที่แนะนำในการติดตั้งการขึ้นต่อกัน หรือติดตั้งการขึ้นต่อกันของ 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.

Note

สำหรับภาษาที่ใช้ อินเทอร์เฟซจากขวาไปซ้าย (เช่น อารบิกหรือฮีบรู) จำเป็นต้องมีแพ็คเกจ rtlcss

  1. ดาวน์โหลดและติดตั้ง nodejs และ npm ด้วยตัวจัดการแพ็คเกจ

  2. ติดตั้ง rtlcss:

    $ sudo npm install -g rtlcss
    

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.

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_user CLI argument.