Last active
April 12, 2020 21:58
-
-
Save linuxbiekaisar/4d466ca54f562b9e2807394ca3aa13e6 to your computer and use it in GitHub Desktop.
How to install Beego on Ubuntu 18.04 LTS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Youtube: https://www.youtube.com/watch?v=w_a1ujFw1us | |
# !/bin/sh | |
# For installing Beego on Ubuntu run the following commands. | |
# Make a directory a home folder and enter in the folder. | |
mkdir golang_source | |
cd golang_source | |
# Download Golang and extract it to /usr/local folder | |
wget https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz | |
sudo tar -zxvf go1.13.3.linux-amd64.tar.gz -C /usr/local | |
# Setup GOROOT and PATH environment variables: | |
echo 'export GOROOT=/usr/local/go' | sudo tee -a /etc/profile | |
echo 'export PATH=$PATH:/usr/local/go/bin' | sudo tee -a /etc/profile | |
source /etc/profile | |
# Check golang and env version. | |
sudo go version | |
sudo go env | |
# Setup GOPATH and PATH environment variables (for bee tool): | |
sudo mkdir -p /usr/local/go_path | |
echo 'export GOPATH=/usr/local/go_path' | sudo tee -a /etc/profile | |
echo 'export PATH=$PATH:/usr/local/go_path/bin' | sudo tee -a /etc/profile | |
source /etc/profile | |
# You can write a simple Golang program and give it a shot: | |
cd /usr/local/go_path | |
sudo mkdir -p src/linuxbiekaisar | |
cd src/linuxbiekaisar | |
sudo nano hellokaisar.go | |
#---- | |
package main | |
import "fmt" | |
func main() { | |
fmt.Printf("hello, Rakiblinux\n") | |
} | |
#---- | |
# Now save and exit its then run it | |
go run hellokaisar.go | |
# If everything was done correctly, you will see the output: | |
hello Its me, LinuxBieKaisar | |
# Now chenge the permision for user: | |
sudo chown -Rv rakib:rakib /usr/local/go_path | |
# Install Beego | |
go get github.com/astaxie/beego | |
# If you not installed Git before then install Git via this command otherwise you can skip. | |
sudo apt-get install git | |
# Git https is not accessible. Please config local git and close https validation: | |
git config --global http.sslVerify false | |
# Install Bee tool | |
go get github.com/beego/bee | |
go install github.com/beego/be | |
# bee tool commands | |
bee | |
# Create new beego project with bee tool | |
bee new kaisar_app | |
cd src/kaisar_app | |
# Now run the bee project | |
bee run | |
# Enjoy using Beego through accessing in your browser, | |
http://your-ip:8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment