顯示包含「Linux」標籤的文章。顯示所有文章
顯示包含「Linux」標籤的文章。顯示所有文章

2026年8月5日星期三

Install Timescale and Postgresql for Ubuntu 26.04

 1. sudo apt update


2. sudo apt install -y postgresql-18 postgresql-client-18 postgresql-18-timescaledb


3. sudo nano /etc/postgresql/18/main/postgresql.conf

add a new line: 

shared_preload_libraries = 'timescaledb'


4. restart postgresql: sudo systemctl restart postgresql

2026年2月10日星期二

建立 Linux 開機動畫程序

 大部份 Linux 系統都是用 Plymount (https://www.freedesktop.org/wiki/Software/Plymouth/) 來處理開機畫面顯示.

如果打算製作開機動畫效果, 可以使用以下軟件: Plymouth-Creator

https://github.com/Techcrafter/Plymouth-Creator

它主管是將 MP4 影片導出為多個 PNG 檔案, 再利用 Scripts 模組 (https://www.freedesktop.org/wiki/Software/Plymouth/Scripts/) 來實現動畫功能

2026年2月1日星期日

在 Ubuntu 24.02 安裝 OpenKM 和 GitLab Community Edition

 在 Ubuntu 24.04 下安裝 OpenKM Community Edition


1. 建立用戶 openkm:


sudo adduser openkm

sudo usermod -aG sudo openkm


2. 登出並登入 openkm


***** 以下操作是在 openkm 用戶下進行 *****


3. 更新 APT 庫記錄


sudo apt-get update


4. 安裝 Apache HTTP 伺服器, Maridb 伺服器和 OpenJava


sudo apt install apache2 mariadb-server openjdk-8-jdk -y

 

5. 配置 Maridb 伺服器


sudo mysql_secure_installation


6. 下載 OpenKM 的 Installer 檔案 OKMInstaller.jar


https://www.openkm.com/en/download.html


7. 執行 OpenKM Installer


sudo java -jar OKMInstaller.jar


***** 以下操作假設除了 database 設定為 mariadb 和密碼為自定義外, 其他為預設值 *****


安裝過程中, 它會自動下載需要的 DEB 檔案


此外, 安裝程序會在 /etc/init.d 之下建立了 openkm 的檔案來啟動/停止/重啟 OpenKM

所以, 我們可以使用指令來: 


啟動 OpenKM 伺服器:

sudo service openkm start


停止 OpenKM 伺服器:

sudo service openkm stop


重啟 OpenKM 伺服器:

sudo service openkm restart


8. 根據安裝指示, 登入 Mariadb (指令: mysql -u root -p), 輸入有關的 SQL 指令來建立數據庫

註:

8.1. 為了完全支持 UTF8 編碼, 最好將 SQL 指令中的 utf8 改為 utf8mb4, utf8_bin 改為 utf8mb4_bin

例如: CREATE DATABASE okmdb DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin; 改為 CREATE DATABASE okmdb DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_bin;


8.2. 如果打算透過 ZIP 檔案來批量上載檔案, 在建立 ZIP 檔案時, 將 Parameter 部份增加 cu+ 參數

 (參考: https://forum.openkm.com/viewtopic.php?t=20585&start=15)


9. 由於 GitLab 會用 8080, 8181 埠, 所以我們先改動 OpenKM 的 Tomcat Connector Port 設定, 不用 8080 埠


參考 https://docs.openkm.com/kcenter/view/okm-6.3-com/configuring-tomcat-port.html 的說明, 修改 tomcat/conf 下的 server.xml 檔案:


nano ./tomcat/conf/server.xml


10. 如果啟動了 Firewall, 我們需要將用到的 Tomcat Connector Port 加入 firewall 列表:

sudo ufw allow <Tomcat Connector Port number>


11. 初次啟動 OpenKM 伺服器 


sudo systemctl daemon-reload

sudo service openkm start


12: 測試登入 OpenKM


啟動 Firefox, 輸入 http://localhost:<Tomcat Connector Port number>/


例如: http://localhost:8280/


正常情況下會看到登入畫面, 然後輸入預設用戶:


login: okmAdmin

password: admin


如果可以登入就証明 OpenKM 已經可用了. 之後系統會在啟動時自動啟動 OpenKM 服務


在 Ubuntu 24.04 下安裝 GitLab Community Edition


參考: https://docs.gitlab.com/install/package/ubuntu/


1. 安裝和啟動 OpenSSH 伺服器


sudo apt update

sudo apt install openssh-server -y

sudo ufw allow OpenSSH


sudo systemctl enable --now ssh


2. 設定及啟動 Firewall


sudo ufw allow 22/tcp

sudo ufw allow 80/tcp

sudo ufw allow 443/tcp

sudo ufw enable


3. 安裝 Curl


sudo apt install -y curl


4. 將 Gitlab Community Edition (即 Gitlab CE) 加到 apt 庳


curl "https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh" | sudo bash


5. 下載及安裝 GitLab CE


sudo apt install gitlab-ce


註: 我們不設定 EXTERNAL_URL 是因為我們不想安裝程序 "立刻" 設定 GitLab (因為安裝會自動設定 LetsEncrypt, 如果無法設定 LetsEncrypt, 安裝將會失敗)


***** 注意 *****


以下流程是基於以下假設:


1. 只供內部網絡用

2. 內部網絡沒有 DNS, 只使用 IP 地址來連接伺服器

3. 只用 HTTP  (一般情況下, 除非客戶端程序 (例如:瀏覽器) 必需使用 HTTPS, 否則在內部網絡用 "自簽" 証書的 HTTPS 是 (基本上) 沒什麼意義)


****************


參考: https://docs.gitlab.com/omnibus/settings/nginx/#use-a-non-bundled-web-server


6. 修改 GitLab 設定檔案:


sudo nano /etc/gitlab/gitlab.rb


6.1 由於只供內部網絡用和沒有 domain name, 所以停用 Let's Encrypt:


letsencrypt['enable'] = false


6.2 由於使用 Ubuntu 內的 Apache 伺服器, 所以停止 GitLab 內部的 Nginx 伺服器


nginx['enable'] = false


6.3 設定與 Apache 有關的設定


web_server['external_users'] = ['www-data']


gitlab_workhorse['listen_network'] = "tcp"

gitlab_workhorse['listen_addr'] = "127.0.0.1:8181"


7. 執行設定:


sudo gitlab-ctl reconfigure


8. 將 www-data 加入 gitlab-www 組:


sudo usermod -aG gitlab-www www-data


9. 在以下 URL 下載 Apache config 檔案:


https://gitlab.com/gitlab-org/gitlab-recipes/-/tree/master/web-server/apache?ref_type=heads


由於 Ubuntu 24.02 是安裝 2.4 版本, 所以檔案是 gitlab-omnibus-apache24.conf


10. 修改 gitlab-omnibus-apache24.conf


nano gitlab-omnibus-apache24.conf


10.1 修正檔案路徑


停用所有 "For CentOS" 部份, 即加上 # 字, 使用 "For Debian distribution" 部份, 即刪除 # 字


註: 你可以將路徑中的 YOUR_SERVER_FQDN 改為其他容易明白的名稱, 例如: gitlab_server


10.2 設定 IP Based Virtual Hosting


10.2.1 將 Server Name 設定為伺服器 IP 地址. 例如: 如果伺服器 IP 地址是 192.168.56.101 那麼設定為 ServerName 192.168.56.101

10.2.2 將 ProxyPassReverse 的 http://YOUR_SERVER_FQDN/ 改為 http://"伺服器 IP 地址"/ 例如: 如果伺服器 IP 地址是 192.168.56.101 那麼設定為 ProxyPassReverse http://192.168.56.101/ 

10.2.3 如果電腦是有多網卡並要同時支持不同網絡, 那麼可以增加 ServerAlias 設定. 例如電腦有 2 個 IP: 192.168.56.101 和 192.168.2.151, 那麼增加 ServerAlias 192.168.2.151


以下是一個修改後的例子:


<VirtualHost *:80>

  ServerName 192.168.56.101

  # Assume the following ip address is assigned for another network interface

  ServerAlias 192.168.2.151

  ServerSignature Off


  ProxyPreserveHost On


  # Ensure that encoded slashes are not decoded but left in their encoded state.

  # http://doc.gitlab.com/ce/api/projects.html#get-single-project

  AllowEncodedSlashes NoDecode


  <Location />

    # New authorization commands for apache 2.4 and up

    # http://httpd.apache.org/docs/2.4/upgrading.html#access

    Require all granted


    #Allow forwarding to gitlab-workhorse

    ProxyPassReverse http://127.0.0.1:8181

    ProxyPassReverse http://192.168.56.101/

  </Location>


  # Apache equivalent of nginx try files

  # http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files

  # http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab

  RewriteEngine on


  # Enable WebSocket reverse Proxy

  # Needs proxy_wstunnel enabled

  RewriteCond %{HTTP:Upgrade} websocket [NC]

  RewriteCond %{HTTP:Connection} upgrade [NC]

  RewriteRule ^/?(.*) "ws://127.0.0.1:8181/$1" [P,L]


  #Forward all requests to gitlab-workhorse except existing files like error documents

  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]

  RewriteCond %{REQUEST_URI} ^/uploads/.*

  RewriteRule .* http://127.0.0.1:8181%{REQUEST_URI} [P,QSA,NE]


  # needed for downloading attachments

  DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public


  #Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/deploy page is thrown up.

  ErrorDocument 404 /404.html

  ErrorDocument 422 /422.html

  ErrorDocument 500 /500.html

  ErrorDocument 502 /502.html

  ErrorDocument 503 /503.html


  # Debian and CentOS distribution defaults provided below

  LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded


  #For CentOS distributions use

  #ErrorLog /var/log/httpd/logs/YOUR_SERVER_FQDN_error.log

  #CustomLog /var/log/httpd/logs/YOUR_SERVER_FQDN_forwarded.log common_forwarded

  #CustomLog /var/log/httpd/logs/YOUR_SERVER_FQDN_access.log combined env=!dontlog

  #CustomLog /var/log/httpd/logs/YOUR_SERVER_FQDN.log combined


  #For Debian distributions use

  ErrorLog /var/log/apache2/gitlab_server_error.log

  CustomLog /var/log/apache2/gitlib_server_forwarded.log common_forwarded

  CustomLog /var/log/apache2/gitlab_server_access.log combined env=!dontlog

  CustomLog /var/log/apache2/gitlab_server.log combined


</VirtualHost>


11. 將 conf 檔案複製到 apache 設定資料夾:


sudo cp gitlab-omnibus-apache24.conf /etc/apache2/sites-available/


12. 啟動設定


sudo a2ensite gitlab-omnibus-apache24


13. 啟動以下 Apache 模組


sudo a2enmod proxy proxy_http rewrite


14. 重啟 apache 伺服器


sudo systemctl reload apache2


15. 用 Firefox 測試是否可以顯示 GitLab 登入畫面


http://"伺服器 IP 地址"/ 例如: http://192.168.56.101/


16. 第一次登入 GitLab


參考: https://docs.gitlab.com/install/next_steps/#initial-sign-in


登入用戶: root

密碼: 在 /etc/gitlab/initial_root_password 內 (安裝 24 小時後會被自動刪除)


如果可以成功登入, 那 GitLab 是可以用了. (記得修改 root 密碼)

2021年2月3日星期三

Directory Selection Menu Example for Linux (Bash Shell Script)

 #!/bin/bash

selectdir() {

# get directory list and convert it to an array

dir_list=($(ls -d $1/* | awk '{ print $1 }'))


selection=$(whiptail --title "Folder Selection" --menu "Select a folder:" 14 40 6 \

            `for index in ${!dir_list[*]}; do printf "%d %s " $index ${dir_list[$index]}; done` \

            3>&1 1>&2 2>&3)


exitstatus=$?

if [ $exitstatus -eq 0 ]; then

    echo ${dir_list[$selection]}

fi

}

path=$(selectdir $PWD)

echo "selected path = "$path


2018年4月11日星期三

iBus, iBus Pinyin and BLFS 8.2 (Systemd edition)

1. Remove "i18h.h" for iBus

We can remove the file "/etc/profile.d/i18n.h" so that the system variable "LANG" will be handled by the file "/etc/locale.conf" only. The advantage is we can use the systemd command "localectl" to configure the system locale. (The command "localectl will NOT handle the file "i18h.h" so sometimes you will find that the system locale is incorrect even you have used the command "localectl" to set your system locale setting.)

2. Setup system variables for ibus

Create the following file:

cat > /etc/profile.d/ibus.sh << EOF

export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus

EOF

3. Setup auto start for iBus

Create the following file:

cat > /etc/xdg/autostart/ibus-daemon.desktop << EOF

[Desktop Entry]
Type=Application
Encoding=UTF-8
Version=1.5.18
Name=ibus-daemon
Comment=iBus Daemon
Exec=/usr/bin/ibus-daemon --xim -d
X-GNOME-Autostart-enabled=true
X-KDE-autostart-after=panel

EOF

4. Build iBus Pinyin

4.1 Install Berkely Database

4.2 Download three files from iBus libpinyin web site (https://sourceforge.net/projects/libpinyin)

- libpinyin source code
- model file (in this example, model15 is used)
- ibus-pinyin source code

4.3 Build libpinyin

extract the source code package and run the following commands:

cp ../model15.text.tar.gz data/
sed '51,51d' -i data/Makefile.am

./autogen.sh --prefix=/usr --disable-static
make
make install

Note: The above "cp" and "sed" commands are used to remove the "wget" instruction and copy the model file to the target folder so we can build the source codes in the offline environment.

4.4 Build ibus-pinyin

extract the sourc code package and run the following commands:

./autogen.sh --prefix=/usr --sysconfdir=/etc
make
make install

5. Test iBus for pinyin

If you run the command "gtk-query-immodules-2.0" (for GTK+ 2.x) or the command "gtk-query-immodules-3.0" (for GTK+ 3.x), you will find that iBus input module will be activated if the beginning of the system locale is "zh", "ja" or "ko" only.
Therefore, we have to use the systemd command "localectl" to set the correct system locale such as "zh_CN.GB18030". You can run "locale -a" to find out the available system locale and read the Chapter 6.2 (Glibc 2.27) of LFS 8.2 for more information.

Then, you can start the iBus configure panel and add "Pinyin" method in the list.
Now, you should able to switch iBus input method and input Chinese characters in your text editor (e.g. mousepad).

Setup Notification Deamo for BLFS 8.2

If Notification daemon is not started automatically, you can run the following command (as root):

cp /usr/share/applications/notification-daemon.desktop /etc/xdg/autostart/

2018年4月7日星期六

Install Onboard for BLFS 8.2

1. Install hunspell

1.1 extract the source code package
1.2 execute:
autoreconf -vfi
./configure --prefix=/usr --sysconfdir=/etc
make
make install
ldconfig

2. Install python distutils extra

2.1 extract the source code package
2.2 execute:
python3 setup.py build
python3 setup.py install --optimize=1


3. Install Onboard

3.1 extract the source code package
3.2 execute:

python3 setup.py build
python3 setup.py install --optimize=1

glib-compile-schemas /usr/share/glib-2.0/schemas


Install X11Vnc for BLFS 8.2

X11Vnc is a VNC server for Linux

1. Install libvncserver

1.1 extract the source code package
1.2 execute:
./autogen.sh --prefix=/usr
make
make install

2. Install TCL and TK packages

3. Install x11vnc

3.1 extract the source codes package
3.2 execute:
./autogen.sh --prefix=/usr --sysconfdir=/etc
make
make install

xinput_calibrator and xorg driver

xinput_calibrator (version 0.7.5) is a X Window calibration application for touch screen device.
However, it only works with "evdev" xorg driver and cannot work with "libinput" xorg dirver.

To check which xorg driver is using for your touch screen device, we can execute the following command:

grep -e "Using input driver" /var/log/Xorg.0.log

If you find that "libinput" is using for your touch screen device, you have to create a configuration file to fix it:

cat > /usr/share/X11/xorg.conf.d/90-FixTouchDriver.conf << "EOF"

Section "InputClass"
    Identifier "You touch screen device Id"
    MatchIsTouchscreen          "on"
    MatchDevicePath              "/dev/input/event*"
    Driver                                "evdev"
EndSection

EOF

Then, xinput_calibrator should be able to get the correct values from the xorg driver.

2017年3月19日星期日

A simple program with NCURSES panel and menu libraries

The HTML Version codes was generated by CodeColorizer.

#include <ncurses.h>
#include <menu.h>
#include <panel.h>
#include <stdlib.h>
#include <string.h>

#define COLOR_MAIN_SCREEN           1

#define MENU_MARKER                 "->"

#define TOTAL_MENU_WINDOWS          1

#define MENU_INDEX_MAIN             0

typedef struct _menu_window_data_ {
    WINDOW          *win;
    MENU            *menu;
    PANEL           *panel;
    ITEM            **item_list;
    int             total_items;
} MENU_WIN_DATA;

MENU_WIN_DATA menu_window_list[TOTAL_MENU_WINDOWS];

void move_to_center(MENU_WIN_DATA *win_data) {
    int     width, height;
    int     scr_width, scr_height;
    
    getmaxyx(stdscr, scr_height, scr_width);
    getmaxyx(win_data->win, height, width);
    
    move_panel(win_data->panel, (scr_height - height) / 2, (scr_width - width) / 2);    
}

void hide_menu_window(MENU_WIN_DATA *win_data) {
    hide_panel(win_data->panel);    
}

void show_menu_window(MENU_WIN_DATA *win_data) {
    show_panel(win_data->panel);    
}

void create_menu_window(MENU_WIN_DATA *win_data, const char **menu_content, int total_items) {    
    win_data->total_items = total_items;
    
    // create a menu    
    win_data->item_list = (ITEM**)calloc(win_data->total_items + 1, sizeof(ITEM*));
    
    int width = 0;
    
    for(int i=0; i<win_data->total_items; i++) {
        win_data->item_list[i] = new_item(menu_content[i], "");
        int len = strlen(menu_content[i]);
        if(len > width) {
            width = len;
        }
    } // i loop
    win_data->item_list[win_data->total_items] = (ITEM*)NULL;
    
    win_data->menu = new_menu(win_data->item_list);
    set_menu_mark(win_data->menu, MENU_MARKER);    
    width += strlen(MENU_MARKER);
    
    // create a window for the menu
    win_data->win = newwin(win_data->total_items + 2, width + 2, 0, 0);
    keypad(win_data->win, TRUE);
    box(win_data->win, 0, 0);
    
    // create a panel for the window
    win_data->panel = new_panel(win_data->win);
            
    // assign the window to the menu
    set_menu_win(win_data->menu, win_data->win);
    set_menu_sub(win_data->menu, derwin(win_data->win, win_data->total_items + 1, width, 1, 1));
    
    // show the menu    
    post_menu(win_data->menu);    
}

void cleanup_menu_window(MENU_WIN_DATA *win_data) {
    del_panel(win_data->panel);
    
    unpost_menu(win_data->menu);
    free_menu(win_data->menu);

    for(int i=0; i<win_data->total_items; i++) {
        free_item(win_data->item_list[i]);
    }
    
    free(win_data->item_list);
    
    delwin(win_data->win);
    
    win_data->win = 0;
    win_data->panel = 0;
    win_data->menu = 0;
    win_data->item_list = 0;
    win_data->total_items = 0;
}

void cleanup_menu_windows() {
    
    for(int i=0; i<TOTAL_MENU_WINDOWS; i++) {
        cleanup_menu_window(&menu_window_list[i]);
    } // i loop
}

int main() {
    initscr();
    
    cbreak();
    noecho();
    raw();
    keypad(stdscr, TRUE);   // enable function keys
    curs_set(0);            // hide the cursor
    
    if(has_colors()) {
        start_color();
        
        init_pair(COLOR_MAIN_SCREEN, COLOR_WHITE, COLOR_BLUE);
        
        bkgd(COLOR_PAIR(COLOR_MAIN_SCREEN) | '.');
    }
    
    const char *main_menu_content[] = { "Item #1", "Item #2", "Exit" };
    
    create_menu_window(&menu_window_list[MENU_INDEX_MAIN], main_menu_content, 3);
    move_to_center(&menu_window_list[MENU_INDEX_MAIN]);
    
    // input loop
    int current_selection = 0;
    int run_flag = 1;
    int c;
    
    do {
        // display panels
        update_panels();
        doupdate();
        
        // get user's input
        c = getch();
        
        switch(c) {
        case KEY_UP:
            if(current_selection > 0) {
                menu_driver(menu_window_list[MENU_INDEX_MAIN].menu, REQ_UP_ITEM);
                current_selection--;
            }
            break;
        case KEY_DOWN:
            if(current_selection < menu_window_list[MENU_INDEX_MAIN].total_items - 1) {
                menu_driver(menu_window_list[MENU_INDEX_MAIN].menu, REQ_DOWN_ITEM);
                current_selection++;
            }
            break;
        case 10:    // Enter key
        {            
            if(current_selection == menu_window_list[MENU_INDEX_MAIN].total_items - 1) {
                // Exit
                run_flag = 0;
            }
        }
            break;
        default:            
            break;
        }
    } while(run_flag);
    
    cleanup_menu_windows();
    
    endwin();
    return 0;
}

2015年12月13日星期日

Notes for building BLFS 7.x

1. Default icons for GTK+ 3.x applications

In order to show all general icons for GTK+ 3.x applications, we have to install adwaita-icon-theme.
That's because the default icon theme for GTK+ 3 is "Adwaita". That means GTK+ 3 will try to search all missing icons from "adwaita" icon theme. On the other hand, that means we do not need to setup something likes "gtk-icon-theme-name = "Adwaita"" in the configuration file (e.g. /etc/gtk-3.0/settings.ini).

Reference:
https://developer.gnome.org/gtk3/stable/GtkSettings.html#GtkSettings--gtk-icon-theme-name

2. "hicolor" icon theme

According to the "Icon Theme specification", the "hicolor" icon theme should be available (Refer to the Directory Layout section of the specification):
In order to have a place for third party applications to install their icons there should always exist a theme called "hicolor". The data for the hicolor theme is available for download at: http://www.freedesktop.org/software/icon-theme/. Implementations are required to look in the "hicolor" theme if an icon was not found in the current theme.

Reference:
http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

3. VirtualBox Guest Addition

After VirtualBox 5.0.10, we do not need to create the link or file "/etc/rc.d/init.d/function" for VirtualBox Guest Addition because it is not needed anymore.

Reference:
https://www.virtualbox.org/ticket/14733

4. FHS media mount point for UDisk

If you want to set the mount point of media from "/run/media" to "/media", you have to add the option "--enable-fhs-media" when you build the UDisk package.

5. X Window Desktop file of UXterm (For LXQT)

5.1 extract the xterm source package
5.2 cp -v *.desktop /usr/share/applications/

6. Handle missing icons in the "Choose an Application" dialog box for LXQT

We have to create the related symbolic links of icon images for those application that the icon image file is missing in the /usr/share/icons directory.
For example,
ln -s /usr/share/pixmaps/assistant-qt5.png /usr/share/icons/hicolor/128x128/apps/assistant-qt5.png

Reference:
Some icon are missing in the "Choose an Application" dialog box

2015年8月30日星期日

Porg - Management of software packages installed for BLFS 7.7

Porg is a software to manage the software packages that are installed from source codes.
Here is the build process for it:

Download the software from here and extract it

./configure --prefix=/usr --sysconfigdir=/etc
make
make install

Example of use:
porg -lp foo-1.2.3 -- 'make install'
porg -tsf foo-1.2.3
porg -lD -- "make install"

2015年8月23日星期日

X Window Desktop file for Qt Creator (BLFS 7.7)

[Desktop Entry]
Name=Qt Creator (Community)
Comment=Creator for Qt applications
Exec=/usr/bin/qtcreator
Icon=QtProject-qtcreator.png
Terminal=false
Encoding=UTF-8
Type=Application
Categories=Qt:Development;

2015年6月27日星期六

Network Manager Configuration for BLFS 7.7

Update: 2015.12.13: fix some errors for icon theme

After we install the Network Manager (Networking Utilities), we have to modify the system configuration in order to allow the Network Manager fully control the network setting.

1. Remove the LFS network setup files
In the “7.5 General Network Configuration” section of LFS, we have created some “ifconfig.*” files for different network interfaces. Those files conflict with Network Manager so we have to remove them. Network Manager will create the configuration files in the “/etc/NetworkManager/system-connections” directory.

2. Install icons files for Network Manager Applet
Network Manager Applet (GNOME Applications) can be used with XFACE and LXDE. This software requires Adwaita Icon theme (GNOME Libraries and Utilities) to display all icons.

3. Update icons files for Network Manager Applet
run the following command:
gtk-update-icon-cache -qt /usr/share/icons/hicolor

4. Fix Polkit-gnome autostart problem for LXDE
If you use LXDE and the polkit daemon ("/usr/lib/polkit-1/polkitd --no-debug") is not started automatically, we have to modify the automatic startup file for polkit-gnome agent (/etc/xdg/autostart/polkit-gnome-authentication-agent-1.desktop):
The line "OnlyShowIn=GNOME;XFCE;Unity;" is changed to "OnlyShowIn=GNOME;XFCE;Unity;LXDE;"

5. Setup Polkit-gnome
In order to gain the permission for other users to setup and modify the network setting, we have to setup PolicyKit permission. Here are some references for the setup:
NetworkManager – ArchWiki
Polkit Reference Manual

For example, create a new group NNNNN and then add the users to this group:
usermod –a –G NNNNN user_xxxxx

And create a file in “/etc/polkit-1/rules.d/” directory that the content is:
polkit.addRule(function(action, subject) {
  if(action.id.indexOf(“org.freedesktop.NetworkManager”) == 0 && subject.IsInGroup(“NNNNN”)) {
    return polkit.Result.YES;
  }
});

Then the members of the group NNNNN will gain the permission to modify and setup the network setting by Network Manager Applet.

Display background image for Grub2 under LFS system

1. Install Unicode Font file (PF2 format)

Download the Unicode font file (BDF format) from GNU Unifont Glyphs and then run the following command to generate a Unicode Font file (PF2 format, the output font size is set to 16, output file name is “unicode.pf2” and the input file name is “unifont.bdf”)

grub-mkfont –s 16 –o unicode.pf2 unifont.bdf

Then copy the output file (unicode.pf2) to “/boot/grub/fonts” directory.

(If grub-mkfont is not found, add the option "--enable-grub-mkfont" when you re-build the grub tool.)

2. Setup grub.cfg

In the grub.cfg, add the following codes to display the background image (in this example, the image file is “/boot/grub/bg.png”):

if loadfont unicode; then
  set gfxmode=auto
  insmod vbe
  insmod vga
  insmod gfxterm
  set locale_dir=/boot/grub/locale
  set lang=en_US
  insmod gettext
  terminal_output gfxterm

  insmod png
  background_image /boot/grub/bg.png
fi

Then the grub2 should display the image file.

If your system uses Plymouth after grub2, you can add the line "set gfxpayload=keep" in the grub.cfg so the image file will be kept until plymouth is running.
(Warning: Do not add this line if plymouth or X window system is not ran automatically because you will not get the terminal in text mode)

2015年6月22日星期一

Setup Bootsplash for BLFS 7.7 with Plymouth

My note for bootsplash setup for BLFS 7.7

EverNote Version

2015年6月14日星期日

Setup Plymouth under BLFS 7.7 with VMware

My note for Plymouth setup for BLFS 7.7

EverNote Version


Fix bad display error for xauth

When xauth shows the error message: "bad display name "xxxxx:0" in "add" command because of "unknown host" error", you can try to ping xxxxx and then you will get the "unknown host" error.

In order to fix this error, we have to edit the file "/etc/hosts" and add the IP address for the xxxxx. For example,
127.0.0.1   xxxxx

Then the problem should be fixed.

2015年5月17日星期日

Patch Linux kernel source codes from 3.19.8 to 4.0.3

The version structure of the Linux kernel:

If we want to "upgrade" the Linux 3.19.8 source codes to Linux 4.0.3, we have to:

1. Rollback Linux 3.19.8 source codes to Linux 3.19 source codes by the 3.19.8 patch file:
cd linux-3.19.8
patch -p1 -R -i ../patch-3.19.8

2. Update the Linux 3.19 source codes to Linux 4.0 source codes by the 4.0 patch file:
patch -p1 -i ../patch-4.0

3. Update the Linux 4.0 source codes to Linux 4.0.3 source codes by the 4.0.3 patch file:
patch -p1 -i ../patch-4.0.3

2015年5月16日星期六

Notes for building BLFS 7.7 in the offline mode

Udisk 2.1.4 and dconf
Add “disable-man” option otherwise the build process will try to download the document sources from internet

gvfs
Add “disable-documentation” option otherwise the build process will try to download the document sources from internet

lxdm
Add “--without-pam” if PAM is not available

gnome keyring
Add “disable-doc” option otherwise the build process will try to download the document sources from internet


libsecret
Use “disable-manpages” option otherwise the build process will try to download the document sources from internet