Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install MailHog on Ubuntu 16.04

#Prerequisit

Install Go programming language and Configure home directory for Go language

Digital Ocean Doc

cd ~
curl -O https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz
tar xvf go1.6.linux-amd64.tar.gz
sudo chown -R root:root ./go
sudo mv go /usr/local
export GOPATH=$HOME/work
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
mkdir ./work

#Install MailHog Main GitHub repo
Download link for MailHog

cd ~/
wget https://github.com/mailhog/MailHog/releases/download/v0.2.1/MailHog_linux_amd64
sudo cp MailHog_linux_amd64 /usr/bin/mailhog

#Install mhsendmail, sendmail replacement for MailHog GitHub repo

sudo go get github.com/mailhog/mhsendmail

This will install mhsendmail to ~/go/bin/mhsendmail, to insatll globally

sudo ln  ~/work/bin/mhsendmail /usr/bin/mhsendmail
sudo ln  ~/work/bin/mhsendmail /usr/bin/sendmail
sudo ln  ~/work/bin/mhsendmail /usr/bin/mail

#Configure PHP Add following line to php.ini

sendmail_path = /usr/bin/mhsendmail
@chisNaN

This comment has been minimized.

Copy link

commented Dec 30, 2016

thanks but perhaps several things

export with $ won't work
cd is equal to cd ~/
missing this sudo chmod +x /usr/bin/mailhog

and how to start the process

@juampynr

This comment has been minimized.

Copy link

commented Jan 19, 2018

Thanks for sharing this!

I read at https://unix.stackexchange.com/a/8658/30962 that /usr/bin is reserved for distribution packages, so it's better to use /usr/local/bin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.