Hexa's Blog

How to install open-webui for llama model on Fedora?

31/12/2024 @ Saigon LLM

This guide is about installing open-webui on fedora.

1. Update python & pip

$ dnf update python -y
$ pip install --upgrade pip

2. Install open-webui guide

  • Create directory /opt/open-webui
$ mkdir /opt/open-webui
$ cd /opt/open-webui
  • change ownership to your user, do not run with root due to security issue.
$ chown nguyenvinhlinh:nguyenvinhlinh -Rv /opt/open-webui/
  • Setup virtual environment (venv) & install open-webui (do not run as root)
$ python -m venv open-webui-env
$ source open-webui-env/bin/activate
$ pip install open-webui

3. Start open-webui server (do not run as root)

$ open-webui serve
  • Server should be available on http://127.0.0.1:8080
  • All data (sqlite, uploads, cache, db) can be found at /opt/open-webui/open-webui-env/lib/python3.12/site-packages/open_webui/data
open-webui on Chrome
open-webui on Chrome

4. Install Ollama software guide

$ curl -fsSL https://ollama.com/install.sh | sh
$ ollama --version

5. Using ollama to pull/download model

$ ollama pull llama3.2

6. Running with systemd service /etc/systemd/system/open-webui.service

[Unit]
Description=Open WebUI (LLAMA)
After=network.target

[Service]
WorkingDirectory=/opt/open-webui
ExecStart=/opt/open-webui/open-webui-env/bin/open-webui serve
User=nguyenvinhlinh
RemainAfterExit=yes
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

Enable and start open-webui service

$ systemctl enable open-webui
$ systemctl start  open-webui

References

MessBox, my new plastic product

05/12/2024 @ Saigon 3D PrintProjects

I am having a mess table with full of wires. This product is all about to help me clean it up abit.

Btw, if you wonder what is my board. it’s KVM switch. it helps me switch my combo of keyboard+mouse+display with a click!

This is my before image.

[1] Before installation
[1] Before installation
[2] Inside the box
[2] Inside the box
[3] After installation
[3] After installation

There are two type of box

Type Width height
A 2 cm 1 cm
B 2.5 cm 1.5 cm
[4] Type A
[4] Type A
[5] Type B
[5] Type B

Installing Woodpecker natively on Fedora 41

02/12/2024 @ Saigon Linux

Keynotes:

1. Download and install

You can use curl or wget to download from woodpecker releases. Then use

$ rpm install file.rpm

2. Systemd - /etc/systemd/system/woodpecker-server.service

[Unit]
Description=Woodpecker Server
After=network.target

[Service]
WorkingDirectory=/opt/woodpecker-server
EnvironmentFile=/opt/woodpecker-server/woodpecker-server.conf
ExecStart=woodpecker-server
User=root
RemainAfterExit=yes
Restart=on-failure
RestartSec=10
TimeoutStopSec=infinity

[Install]
WantedBy=multi-user.target

3. Config - /opt/woodpecker-server/woodpecker-server.conf

I config to use Gitlab Login - Single Sign On. Plese check this link for more detail.

Github SSO use three variables:

  • WOODPECKER_GITHUB
  • WOODPECKER_GITHUB_CLIENT
  • WOODPECKER_GITHUB_SECRET
WOODPECKER_HOST=https://woodpecker.homelab
WOODPECKER_GITHUB=true
WOODPECKER_GITHUB_CLIENT=XXX
WOODPECKER_GITHUB_SECRET=XXX
WOODPECKER_OPEN=false

WOODPECKER_SERVER_CERT=/opt/woodpecker-server/ssl/woodpecker.homelab.bundle.crt
WOODPECKER_SERVER_KEY=/opt/woodpecker-server/ssl/woodpecker.homelab.key
WOODPECKER_DATABASE_DRIVER=sqlite3
WOODPECKER_DATABASE_DATASOURCE=/opt/woodpecker-server/db/woodpecker.sqlite

4. Firewall-cmd service - /etc/firewalld/services/woodpecker-server.xml

<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>Woodpecker Server</short>
  <description>This option allows woodpecker to use tcp port 443 HTTPS</description>
  <port protocol="tcp" port="443"/>
</service>

5. Test script before using systemd

Write this script and execute it.

$ export WOODPECKER_HOST=https://woodpecker.homelab

$ export WOODPECKER_GITHUB=true
$ export WOODPECKER_GITHUB_CLIENT=XXX
$ export WOODPECKER_GITHUB_SECRET=XXX

$ export WOODPECKER_OPEN=true

$ export WOODPECKER_SERVER_CERT=/opt/woodpecker/ssl/woodpecker.homelab.bundle.crt
$ export WOODPECKER_SERVER_KEY=/opt/woodpecker/ssl/woodpecker.homelab.key

$ export WOODPECKER_DATABASE_DRIVER=sqlite3
$ export WOODPECKER_DATABASE_DATASOURCE=/opt/woodpecker/db/woodpecker.sqlite
$ export WOODPECKER_LOG_LEVEL=debug

$ woodpecker-server

For ssl certificate generator, follow this guide Cách làm Certificate Authority cấp SSL nội bộ.

6. References

SELinux, cannot login to shell after enable it

30/11/2024 @ Saigon Linux

After along time disable SELinux, now you might want to enable it in Enforcing mode. After OS boot, in terminal, you may not login even though you did enter correct username/password. It’s because your files not to be labeled or labeled with SELinux context not matching the install policy.

The solution is that you ask SELinux to re-label in the next reboot. Enter the following command.

$ touch /.autorelabel

Then reboot!

In case you forget to do it. you need to go to rescue mode while booting the system, the GRUB2 menu will be displayed. To boot the system into rescue mode using bash follow these steps:

  • Select the boot entry you wish to edit with the arrow keys.
  • Select the entry you wish to edit by pressing e.
  • Use the arrow keys to go to select the line beginning with linux, linux16, or linuxefi.
  • Go the the end of that line and include a space and the following rw init=/bin/bash. If your disk is encrypted, you may need to add plymouth.enable=0
  • Press Ctrl-x or F10 to boot the entry
  • Then enter command line touch /.autorelabel and reboot!

Good luck!

Refereces:

Nguyen Vinh Linh - Certificate Authority

28/11/2024 @ Saigon etc

Download it here: nguyenvinhlinh-ca.pem

-----BEGIN CERTIFICATE-----
MIIGNzCCBB+gAwIBAgIUY55KFD82PbJPmiJG01quqPSDMOkwDQYJKoZIhvcNAQEL
BQAwgakxCzAJBgNVBAYTAlZOMRkwFwYDVQQIDBBIbyBDaGkgTWluaCBDaXR5MRkw
FwYDVQQHDBBIbyBDaGkgTWluaCBDaXR5MQ4wDAYDVQQKDAVNeSBDQTEOMAwGA1UE
CwwFTXkgQ0ExGTAXBgNVBAMMEE5ndXllbiBWaW5oIExpbmgxKTAnBgkqhkiG9w0B
CQEWGm5ndXllbnZpbmhsaW5oOTNAZ21haWwuY29tMCAXDTIzMDkxMDEwMjEyNloY
DzMwMjMwMTExMTAyMTI2WjCBqTELMAkGA1UEBhMCVk4xGTAXBgNVBAgMEEhvIENo
aSBNaW5oIENpdHkxGTAXBgNVBAcMEEhvIENoaSBNaW5oIENpdHkxDjAMBgNVBAoM
BU15IENBMQ4wDAYDVQQLDAVNeSBDQ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9JP45Xn2KsP6anbk3IqmArys5d9QXkvs7o5Go2r1IdrSLC0IfJfi7nOISuFWrJVO
nvspukxomiYj4bCgUmAxDBZk+48KeOECyZBvZJx/gzQ6RzKVTW0ij5B8iVGChXaM
KT4UI8viOyk2k30W1VJZ3wtTb73n78worTy2fBgKG/gaf28g6qcP9mvOvpIQvjQq
sW0ThFhn8rxV2yrEwbsP9u+/1Pm+nUTy8wCtKejifpbcamiIW/QFPrR9hL5AXcCr
QGrv8u7gWiVGpM5nyKoLOCoT5pyE+eaCS3jNahj8lY0EKs0sYn71zRpWvpBpOhjG
uHDCJJBWhfmqeKzT5qZd99sbQtgafUXfqoAavyebKm9hGcI77m451eM1V0lxpCAC
sVASFUYa6cCOUh1CRNWuStwDkdX7M0YsR3wKPQo8cY1Ln28U6cVykKcswYuwzWC4
EmkXSvdDw0cG9s/GoMFDWxJe3VqElhNHqkaOlgfUFVijSeydiSgdxSt6tlltBzDx
lWmsk2X0gsbxuqiUn6/fCVm3V+6xovRmIInPku49xBeHLJ1sr80YCY/42ZS8zA7w
94XxQsoB6nfJcFc=
-----END CERTIFICATE-----

Bản đồ trường Tôn Đức Thắng

22/11/2024 @ Saigon etc

Bản đồ trường Tôn Đức Thắng
Bản đồ trường Tôn Đức Thắng

OrcaSlicer error, cannot interact with UI at startup

22/11/2024 @ Saigon 3D Print

I have seen this problem using OrcaSlicer V2.2.0 Official Release on Fedora 39. Even though, I clone the source code and build AppImage myself. this issue still happens.

The main solution to this problem is to disable webkit composition mode before executing OrcaSlicer.

$ export WEBKIT_DISABLE_COMPOSITING_MODE=1
$ ./OrcaSlicer_Linux_V2.3.0-dev.AppImage

This is a screenshot prove that this solution does work.

OrcaSlicer is running on Fedora 39
OrcaSlicer is running on Fedora 39

K1 max & Nozzle 0.6mm

16/11/2024 @ Saigon 3D Print

This profile is tested with Creality Ender PLA filament. I only note which is the most important settings.

  • Nozzle: 0.6mm
  • Maximum volumetric speed: 30mm3/s
  • Layer height: 0.3mm
  • Nozzle temperature: 220C
  • Flow ratio: 1
  • Pressure Advance: 0.02
  • First layer:
    • outer wall speed: 50m/s
    • first infill speed: 105mm/s
  • Other layer:
    • outer speed: 105mm/s
    • inner speed: 125mm/s
    • Top surface speed: 105mm/s
[1] Speed settings
[1] Speed settings
  • Retraction
    • Length: 0.5mm
    • Z hop when retract: 0.2mm
    • Z hop type: spiral
    • Retraction speed: 40mm/s
[2] Retraction settings
[2] Retraction settings

Air filter

09/11/2024 @ Saigon Projects

I currently live in a mini apartment with its bathroom not having an exhaust system. This is a major issue.

In reality, it doesn’t need to be said; it’s very inconvenient. The landlord refuses to drill into the wall or make any repairs.

As I am unemployed and addicted to manufacturing, my products aren’t particularly innovative. Yes, they are a gas air purifier. My product is nothing new at all.

But why do I create them when I could just buy one? If I don’t work on simple tasks, even those that others have already done, I’ll never come up with any creative ideas or design anything better than what others have created before. And further, I won’t be able to make more complex products.

If profit is the top priority and time-saving is a goal, I’d look for something on Lazada or Shopee, and then I wouldn’t be able to create anything more refined!

By the way, here are some pictures of the product. Just for fun, I designed and 3D printed it myself.

[1] Plasticity design
[1] Plasticity design
[2] Product from left to right
[2] Product from left to right
[3] Product from right to left
[3] Product from right to left
[4] Activated cabon rack installed
[4] Activated cabon rack installed
[5] Activated cabon rack uninstalled
[5] Activated cabon rack uninstalled

At the time of creating this product, I didn’t have any measuring equipment, so I couldn’t check if the concentration of methanol and ammonia in the air purifier was accurate. I couldn’t even verify if my product really solves a problem or just has a placebo effect.

I hope not, but that’s how I feel about it!

Máy lọc không khí

08/11/2024 @ Saigon Projects

Tôi hiện tại đang sống trong một căn hộ mini mà phòng vệ sinh của nó không có hệ thống thoát khí. Thực sự là vấn đề này chả cần phải nói nhiều, nó rất bất tiện. Chủ căn hộ hoàn toàn không muốn đục tường hay sữa chữa gì cả.

Tôi thì lại đang thất nghiệp và nghiện chế tạo. Sản phẩm tôi làm cũng chả có gì mới. Đúng, nó là máy lọc khí. Sản phẩm chả có gì mới cả.

Nhưng tại sao tôi lại làm thay vì đi mua? Nếu tôi không chịu làm những cái đơn giản, thậm chí người khác đã làm rồi, tôi sẽ không bao giờ có tư duy sáng tạo hay thiết kế cũa những người đi trước. Và xa hơn, tôi cũng sẽ không thể làm ra những sản phẩm có tính phức tạp cao hơn.

Nếu đặt vấn đề lợi nhuận lên hàng đầu, tìm cách tiết kiệm thời gian, tôi sẽ lên lazada, shopee! Và rồi tôi sẽ không thể mạnh hơn được, tôi sẽ không thể tạo ra những thứ khác có độ tinh xảo cao hơn!

Dưới đây là một vài hình ảnh sản phẩm. Nhân tiện, sản phẩm được tôi thiết kế và in 3D.

[1] Thiết kế với Plasticity
[1] Thiết kế với Plasticity
[2] Ảnh chụp từ trái qua phải
[2] Ảnh chụp từ trái qua phải
[3] Ảnh chụp từ phải qua trái
[3] Ảnh chụp từ phải qua trái
[4] Sản phẩm với máng than hoạt tính đã được lắp đặt
[4] Sản phẩm với máng than hoạt tính đã được lắp đặt
[5] Sản phẩm với máng than hoạt tính chưa được lắp đặt
[5] Sản phẩm với máng than hoạt tính chưa được lắp đặt

Ở thời điểm tạo ra sản phẩm này, tôi ko có thiết bị đo đạc, kiểm tra nồng độ của methanol và amoniac, tôi hoàn toàn không thể kiểm tra xem sản phẩm tôi làm có thực sự giải quyết vấn đề hay không, hay nó chỉ là hiệu ứng palacebo!

Tôi hi vọng là không, cảm nhận của tôi là chính xác!