Update tech_docs/linux/conda_install.md

This commit is contained in:
2024-05-12 03:36:19 +00:00
parent 4ea0937ab3
commit 12eafca6f0

View File

@@ -1,61 +1,98 @@
Here's a concise step-by-step guide to download, verify the hash, and set up Conda on your Debian 12 system: Apologies for the confusion. I'll now review the document you provided and include the relevant steps for setting up JupyterLab on a headless server.
1. Update your system: Here's a consolidated guide that combines the steps for installing Conda and setting up JupyterLab on a Debian 12 server:
```
sudo apt update && sudo apt upgrade
```
2. Install required dependencies: # Setting up Conda and JupyterLab on a Debian 12 Server
```
sudo apt install wget gpg python3 python3-pip
```
3. Download the Miniconda installer: ## Step 1: Update your system
```
cd ~/Downloads
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
```
4. Verify the hash of the downloaded installer: ```bash
``` sudo apt update && sudo apt upgrade
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh.sha256 ```
sha256sum Miniconda3-latest-Linux-x86_64.sh
cat Miniconda3-latest-Linux-x86_64.sh.sha256
```
5. Install Miniconda: ## Step 2: Install required dependencies
```
chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh
```
6. Initialize Conda: ```bash
``` sudo apt install wget gpg python3 python3-pip
source ~/.bashrc ```
conda --version
conda init bash
```
7. Create a Conda environment: ## Step 3: Download and verify the Miniconda installer
```
conda create --name myenv python=3.12
conda activate myenv
```
8. Update pip and install packages within the environment: ```bash
``` cd ~/Downloads
python3 -m pip install --upgrade pip wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
python3 -m pip install jupyter numpy pandas matplotlib wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh.sha256
``` sha256sum Miniconda3-latest-Linux-x86_64.sh
cat Miniconda3-latest-Linux-x86_64.sh.sha256
```
9. Launch Jupyter Notebook from the active environment: ## Step 4: Install Miniconda
```
jupyter notebook
```
10. Deactivate the environment when done: ```bash
``` chmod +x Miniconda3-latest-Linux-x86_64.sh
conda deactivate ./Miniconda3-latest-Linux-x86_64.sh
``` ```
Remember to replace `myenv` with your desired environment name and adjust the Python version and package list according to your requirements. ## Step 5: Initialize Conda
```bash
source ~/.bashrc
conda --version
conda init bash
```
## Step 6: Create a Conda environment
```bash
conda create --name myenv python=3.12
conda activate myenv
```
## Step 7: Install JupyterLab and other packages within the environment
```bash
python3 -m pip install --upgrade pip
python3 -m pip install jupyterlab numpy pandas matplotlib
```
## Step 8: Configure JupyterLab for remote access
```bash
jupyter lab --generate-config
```
Open the `jupyter_lab_config.py` file located in `~/.jupyter/` and uncomment the following lines, making sure to set your desired IP address and port:
```python
c.ServerApp.ip = '0.0.0.0' # Set to your server's IP or '0.0.0.0' for all interfaces
c.ServerApp.port = 8888 # Set to your desired port
c.ServerApp.open_browser = False
```
## Step 9: Set a password for JupyterLab
```bash
jupyter lab password
```
## Step 10: Start JupyterLab
```bash
jupyter lab
```
## Step 11: Access JupyterLab
From your local machine, open a web browser and navigate to `http://your_server_ip:8888`. Replace `your_server_ip` with your server's IP address or hostname, and `8888` with the port you configured in step 8 if you changed it.
## Step 12: Deactivate the environment when done
```bash
conda deactivate
```
Remember to replace `myenv` with your desired environment name and adjust the Python version and package list according to your requirements.
Note: For added security, consider using SSH tunneling, configuring a reverse proxy with SSL encryption, or employing firewall rules to restrict access to your JupyterLab instance.
This guide combines the steps for installing Conda, setting up a Conda environment, and configuring JupyterLab to run on a Debian 12 server, accessible remotely from your local machine.