...

To: Friends@cmi, Set Up Your Homepage

Tech Nov 24, 2024

That's true. It doesn't matter if you haven't published yet. You need to have a website.

Inspired from Kira Goldner's blog on Every Academic Needs a Website, this is a customized "how to" article for CMI students. I’m not going to spend time convincing you why you need a website - if you’re still on the fence, go read the linked article above.

This article will walk you through everything you need to do to get your website up and running on: www.cmi.ac.in/~yourname

Step 1: Building Your Homepage Locally

Before uploading your website to the server, you’ll first create and test your homepage on your own computer. I’ve already built a minimal homepage for you to get started. You can download and use it as a template (credit is embedded).

Customizing Your Homepage

  1. Once downloaded, extract the files into a folder where you’ll keep all your website files.
  2. Open the index.html file in any text editor (e.g., VS Code, Sublime Text, Notepad++).
  3. Replace the dummy content with your own text, links, and information.
  4. Add a profile picture of yourself: Save your photo in the assets/img/ folder; Name the file as profile_pic.jpeg.
💡
Tip: Use a smaller file size to ensure your website loads quickly.

Previewing Your Homepage

To see how your website looks, simply open the index.html file you just edited in any web browser. This will give you a live preview of your homepage.

Step 2: Hosting

Once you're satisfied with your website, copy the entire folder (containing index.html and the assets folder) to a pen drive and head to the computer lab. Yes, you will need to visit the lab at least once. In the lab, you'll do two things: 1) Copy your website to the correct directory on the server and 2)  Set up SSH so you can easily update the website from your personal computer in the future.

  1. Login to your accont on any one of the computers at the lab
  2. Next, copy and paste your website files (index.html and the assets folder) into the directory ~/.www/. After that, set the correct permissions for the files to ensure they are accessible:
mkdir -p ~/.www
cp -r /path/to/your/template-cmi-main/* ~/.www
chmod -R 755 ~/.www
Note: The index.html should be in ~/.www and not it any subdirectory
  1. Your Homepage should be live now. Try opening it by visiting www.cmi.ac.in/~username

Step 3: Maintaining 🔧

Unless you want to visit the lab every time you need to make changes to your website, you’ll need a way to remotely access the CMI server. To do this, you’ll need something called an SSH key. SSH keys are secure access credentials, and generating one is easy. Follow these steps to create your SSH key:

  1. Open your terminal (on your personal computer)
  2. Run the following command (replace your_email@example.com with your actual email):
ssh-keygen -t ed25519 -C "your_email@example.com"

This command creates a new SSH key pair and labels it with your email.

  1. When prompted with "Enter a file in which to save the key", press Enter to use the default file location.
  2. At the next prompt, type a secure passphrase.
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]

After completing these steps, you should have two files inside the directory ~/.ssh/: 1. ~/.ssh/id_ed25519.pub (your public key) and 2. ~/.ssh/id_ed25519 (your private key).

  1. Copy the public key to a pen drive and transfer it to the lab computer. Save it somewhere easily accessible, such as the Desktop.
  2. Run the following commands (on the lab computer) to add it to the SSH agent
mkdir -p ~/.ssh
chmod 700 ~/.ssh
cat ~/Desktop/id_ed25519.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
Run these command one after the other

From now on, you should be able to use SSH to connect to the server from your computer. Test the connection by running the following command (on your computer):

ssh username@access2.cmi.ac.in
If it asks Are you sure you want to continue connecting (yes/no)? type yes

This will give you command-line access to your home directory on the CMI server. From there, you can navigate to the ~/.www directory and make minor edits to your site using any command-line editor, such as: nano ~/.www/index.html. For major changes, it’s better to update your website locally on your computer and then transfer the updated files to the CMI server using the following command:

scp -r /path/to/homepage/* username@access2.cmi.ac.in:~/.www/
Run these command one after the other

After transferring the files, don’t forget to SSH into the server again and set the permissions to ensure your website is accessible. Run the following command:

ssh username@access2.cmi.ac.in
chmod -R 755 ~/.www

Congratulations! You’ve got a website! Now, share it with your friends, add it to your resume, and show it off. And if your friends still don’t have a website, bug them until they get one. Everyone deserves their own corner of the internet!

Tags

Vishwa Prakash

Hi, I’m Vishwa. Here, I’ll be sharing thoughts on things I find interesting, including Game Theory, Fair Division, Tech, Fitness, Bodybuilding, Hindustani Music, Linux, and more.