Anaconda is a popular open-source distribution of Python and R, designed specifically for data science, machine learning, and AI development. It comes with a wide array of pre-installed libraries and tools such as Jupyter Notebook, Pandas, NumPy, and SciPy. Hostinger's "Ubuntu 24.04 with Anaconda" VPS template comes with Anaconda preinstalled, allowing you to start working on your projects right away. This guide will walk you through accessing and using Anaconda on your VPS.
Accessing Your VPS
Open Terminal (Linux/macOS) or Command Prompt/PowerShell (Windows) on your local computer and enter the following command:
ssh root@[your-vps-ip]
Replace [your-vps-ip]
with your VPS IP address. You might be prompted to enter your VPS password.
Verifying Anaconda Installation
Check Anaconda Version:
After logging into your VPS, verify that Anaconda is installed by running:
conda --version
Update Anaconda Packages:
Ensure your Anaconda installation is up to date:
conda update --all
Creating and Managing Anaconda Environments
Create a New Environment:
To create a new Anaconda environment with a specific Python version:
conda create -n myenv python=3.9
Replace myenv
with your preferred environment name.
Activate the Environment:
Switch to your newly created environment:
conda activate myenv
Install Additional Packages:
You can install packages using:
conda install numpy pandas matplotlib
Deactivate the Environment:
When done, deactivate the environment using:
conda deactivate
Using Jupyter Notebook
Start Jupyter Notebook:
Start Jupyter Notebook to work on data science projects:
jupyter notebook --ip=0.0.0.0 --no-browser
The terminal will display a URL with an access token. Copy this URL.
Access Jupyter Notebook from Browser:
On your local machine, open your browser and enter:
http://[your-vps-ip]:8888
Replace [your-vps-ip]
with your actual VPS IP address and use the token provided in the terminal.
Securing Your Anaconda Environment
Set Up Firewall Rules:
Allow only necessary ports for Jupyter Notebook and SSH:
sudo ufw allow 22/tcp
sudo ufw allow 8888/tcp
sudo ufw enable
Automating Anaconda Tasks
Creating Scheduled Jobs:
Automate tasks using cron
jobs:
crontab -e
Add an entry to run a Python script at regular intervals:
0 * * * * /root/anaconda3/bin/python /path/to/your_script.py
The "Ubuntu 24.04 with Anaconda" VPS template from Hostinger provides a powerful data science, machine learning, and AI development environment. Following this guide's steps, you can easily set up, manage, and secure your Anaconda environment. Whether you're working on Jupyter notebooks or deploying machine learning models, Anaconda simplifies package management and project organization.
For more information, visit the official Anaconda documentation.