Deploy Snip-IT on Amazon EC2 -Manually
Hello learner, my name is Farhan Ahmed. I am presently pursuing B.Tech. in Computer Science at ITM University, Gwalior. In this article, I will describe the steps of how you can deploy Snip-IT an asset management system for IT, in Amazon EC2 Instance. I tried my best to make it simple. First I start with describing what is Snipe-IT and EC2.
What is Snipe-IT?
Snipe-IT is a free, open-source IT asset management system. It's a database program that helps users track inventory and usage. IT departments can use Snipe-IT to track information like who has which laptop, when it was purchased, and what software licenses and accessories are available.
What is Amazon EC2?
According to the AWS website: Amazon Elastic Compute Cloud (Amazon EC2) provides on-demand, scalable computing capacity in the Amazon Web Services (AWS) Cloud. Using Amazon EC2 reduces hardware costs so you can develop and deploy applications faster. You can use Amazon EC2 to launch as many or as few virtual servers as you need, configure security and networking, and manage storage. You can add capacity (scale up) to handle compute-heavy tasks, such as monthly or yearly processes, or spikes in website traffic. When usage decreases, you can reduce capacity (scale down) again.
You can read about it more here: AWS DOCS
I Divide the whole process into 4 steps given below:
1.????? Launch your Ubuntu EC2 instance.
2.????? Access your EC2 instance.
3.????? Install Snipe-IT in the EC2 instance.
4.????? Run Snipe-IT.
Step 1: Launch your Ubuntu EC2 instance.
1.????? Login to your AWS console.
2.????? Search EC2 in the search box or click Services and select EC2.
3.????? Now EC2 Dashboard Opens.
4.????? Click on Launch Instance.
5.????? Enter the name of your Instance, I named it “Snipe-IT Server”.
6.????? Under “Application and OS Images (Amazon Machine Image)”, Choose Ubuntu Server 22.04 LTS (Free tier eligible). As shown in the screenshot below.
7.????? Choose Instance type “t2.micro”.
8.????? Under Key pair (login), choose your key pair name or create a new key pair.
????????.pem: if you use OpenSSH
????????.ppk: If you use PuTTY??
9.????? Under Network settings Check the following checkboxes:
10.?? Leave other things as it is and click on “Launch instance”.
After a few seconds, your Ubuntu EC2 instance is ready.
You can view your instance, by clicking on the instances in the left sidebar. To see details of your instance check on box near your instance name.
You can see the Public IPv4 address we will use this to access the instance.
Step 2: Access your EC2 instance.
1.????? First copy the Public IPv4 address of your Instance from the EC2 Instance Dashboard.
2.????? Now open your command prompt, and navigate to the folder where your private key “Snipe-it-key-pair.pem” is downloaded or saved.
3.????? Now use ssh to connect with the instance. Enter the following command:
ssh -i "Snipe-it-key-pair.pem" ubuntu@[IP_ADDRESS]
here option -i is used to specify the private key, ubuntu is the username and the remaining is the Public IP address.
replace [IP_ADDRESS] with your instance IP address
4.????? If prompted: “Are you sure you want to continue connecting (yes/no/[fingerprint])?”, enter yes.
Step 3: Install Snipe-IT in the EC2 instance.
1.????? Now we are inside our instance, First update and upgrade the packages using these commands:
sudo apt update -y
sudo apt upgrade -y
2.????? To make the Ubuntu instance a web server you need to install the LAMP stack.
领英推荐
3.????? Install Apache2:
sudo apt install apache2 -y
Start apache2 service: sudo systemctl start apache2
Enable apache2 service: sudo systemctl enable apache2
Now check status of the service: sudo systemctl status apache2
This will show active (running).
You can check the version of apache2 to validate the installation.: apache2 -v
sudo a2enmod rewrite
Restart the server: sudo systemctl restart apache2
4.????? Install Database server MySQL/MariaDB:
Install database server and client:
sudo apt install mariadb-server mariadb-client -y
Start mariadb service: sudo systemctl start mariadb
Enable mariadb service: sudo systemctl enable mariadb
Check status: sudo systemctl status mariadb
e.????? Now secure the installation by running the below command:
sudo mysql_secure_installation
Switch to unix_socket authentication [Y/n] y
Change the root password? [Y/n] n
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
5.????? Install PHP:
sudo apt install php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath
sudo apt install php php-bcmath php-bz2 php-intl php-gd php-mbstring php-mysql php-zip php-opcache php-pdo php-calendar php-ctype php-exif php-ffi php-fileinfo php-ftp php-iconv php-intl php-json php-mysqli php-phar php-posix php-readline php-shmop php-sockets php-sysvmsg php-sysvsem php-sysvshm php-tokenizer php-curl php-ldap -y
Install php composer:
sudo curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
6.????? Create a Database in MariaDB for Snipe-IT:
sudo mysql -u root -p
Enter password: admin?
CREATE DATABASE mysnipeitdb;
CREATE USER farhan@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON mysnipeitdb.* TO farhan@localhost;
FLUSH PRIVILEGES;
EXIT;??
7. Install Snipe-IT:
cd /var/www/
Clone snipe-it repo: sudo git clone https://github.com/snipe/snipe-it snipe-it
Open folder: cd /var/www/snipe-it
Make a copy of example .env file and make few changes:
sudo cp /var/www/snipe-it/.env.example /var/www/snipe-it/.env
sudo nano /var/www/snipe-it/.env
Enter your url in APP_URL
Enter Database name in DB_DATABASE
ENTER USERNAME in DB_USERNAME
ENTER PASSWORD in DB_PASSWORD
sudo chown -R www-data:www-data /var/www/snipe-it
sudo chmod -R 755 /var/www/snipe-it
sudo composer update --no-plugins --no-scripts
sudo composer install --no-dev --prefer-source --no-plugins --no-scripts
sudo php artisan key:generate
Disable default virtual host: sudo a2dissite 000-default.conf
Create and configure snipe-It virtual host:
sudo nano /etc/apache2/sites-available/snipe-it.conf
Enter the below code in .conf file
<VirtualHost *:80>
ServerName snipe-it.syncbricks.com
DocumentRoot /var/www/snipe-it/public
<Directory /var/www/snipe-it/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Ctrl+x and y, enter
Enable Snipe-it configuration: sudo a2ensite snipe-it.conf
sudo chown -R www-data:www-data ./storage
sudo chmod -R 755 ./storage
sudo systemctl restart apache2
Step 4: Run Snipe-IT
Now Enter the IP address in the web browser and run the setup wizard.
In this way, you can easily deploy Snipe-IT on Amazon EC2.
Hope this will help you. Thank you for reading. Connect With me, follow me and subscribe for more updates.