2024年6月29日 星期六

In Ubuntu 20.04, how to install gnuplot from the source code

gnuplot 安裝後若需要 png 類型的輸出,可以依以下步驟安裝:

sudo apt-get update

sudo apt-get install build-essential

sudo apt-get build-dep gnuplot

sudo apt-get install libgd-dev libpng-dev


wget https://sourceforge.net/projects/gnuplot/files/gnuplot/5.2.8/gnuplot-5.2.8.tar.gz

tar -xzf gnuplot-5.2.8.tar.gz

cd gnuplot-5.2.8


./configure --with-gd --with-png

make

mack check

sudo make install


說明:
在使用 wxMaxima 時,inline plot 需要 gnuplot 的 png 類型輸出,所以安裝 gnuplot 時,必需要有安裝 png 類型的 terminal。

可以在 gnuplot> 輸入 set terminal 查看安裝的 terminal 類型。

2024年6月22日 星期六

在 Ubuntu 24.04 中從 Mozilla Builds 安裝 Firefox

Ubuntu 24.04 中,Firefox 預設是從 snap 安裝,然而,從 snap 安裝的版本不能使用 gcin 中文輸入法。為了解決這個問題,我參考以下網頁,依照以下方法,成功安裝 Mozilla Builds Firefox,且可使用中文輸入法。

首先移除已安裝的 firefox:

$ sudo snap remove firefox

$ sudo apt remove firefox 


然後參考:

 Install Firefox from Mozilla builds

1. 從 Mozilla 官網下載 Firefox Linux 64-bit 版本,例如 firefox-127.0.1.tar.bz2

2. 按照以下步驟

$ tar xjf firefox-*.tar.bz2

$ sudo mv firefox /opt

$ sudo ln -s /opt/firefox/firefox /usr/local/bin/firefox

$ sudo wget https://raw.githubusercontent.com/mozilla/sumo-kb/main/install-firefox-linux/firefox.desktop -P /usr/local/share/applications

3. 在終端機執行

$ firefox

即可啟動,而且 gcin 可以正常使用。

2024年6月20日 星期四

在 Ubuntu 20.04 上安裝 cudnn

我的測試環境 

Ubuntu 20.04

NVIDIA-SMI 535.183.01             Driver Version: 535.183.01   CUDA Version: 12.2

用以下的方法,可以確保版本正確的問題

1. **Add NVIDIA package repositories**:
   Ensure you have the CUDA repository added to your system. Follow these steps:

   ```sh
   sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
   sudo sh -c 'echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 /" > /etc/apt/sources.list.d/cuda.list'
   sudo sh -c 'echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2004/x86_64 /" > /etc/apt/sources.list.d/cuda_learn.list'
   ```

2. **Update the package list**:

   ```sh
   sudo apt update
   ```

3. **Install CUDA**:
   Ensure you have CUDA installed. You can install a specific version if needed.

   ```sh
   sudo apt install cuda-12-0
   ```

4. **Install cuDNN**:
   Install the cuDNN package for CUDA 12.

   ```sh
   sudo apt install libcudnn8=8.9.7.29-1+cuda12.2
   sudo apt install libcudnn8-dev=8.9.7.29-1+cuda12.2
   sudo apt install libcudnn8-samples=8.9.7.29-1+cuda12.2
   ```

   Replace `8.x.x.x-1+cuda12.0` with the actual version available in the repository. You can check for the available versions using:

   ```sh
   apt-cache policy libcudnn8
   ```

5. **Verify the installation**:
   Ensure CUDA and cuDNN are installed correctly.

   ```sh
   nvcc --version
   ```

   For cuDNN, you can check the version as follows:

   ```sh
   cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
   ```

參考:
https://chatgpt.com/share/cbe6f18b-d8af-4621-8355-874f205f6a86

https://medium.com/@scofield44165/ubuntu-20-04%E4%B8%AD%E5%AE%89%E8%A3%9Dnvidia-driver-cuda-11-4-2%E7%89%88-cudnn-install-nvidia-driver-460-cuda-11-4-2-cudnn-6569ab816cc5

install nvidia cuda in Ubuntu 20.04

 參考

https://medium.com/@scofield44165/ubuntu-20-04%E4%B8%AD%E5%AE%89%E8%A3%9Dnvidia-driver-cuda-11-4-2%E7%89%88-cudnn-install-nvidia-driver-460-cuda-11-4-2-cudnn-6569ab816cc5