dah85.com

*not* just another blog ;)

As requested by one of my readers, here's how to set up rclone with Google Drive for use with a seedbox.

I'm using Ubuntu 16.04 and this seedbox script: https://github.com/arakasi72/rtinst

I assume that's already set up nicely, now we move on to rclone.

First, we update and install what we need (unzip):

sudo apt update ; sudo apt install -y unzip

Then, we'll download the rclone files into your home directory:

cd ~ 
wget --no-check-certificate https://downloads.rclone.org/rclone-v1.39-linux-amd64.zip

After that, we unzip it:

unzip rclone-v1.39-linux-amd64.zip

Then change into it's folder:

cd rclone-v1.39-linux-amd64

Now, we'll install it to /usr/bin/ so that we can call it from anywhere:

sudo cp rclone /usr/bin/

Now, it's time to set it up!

rclone config

It will ask a bunch of questions, here's how I answered them (just do it in the same order, only change the name of the "remote" from gdrivetest to whatever you wanna call it)

n
gdrivetest
10
<enter>
<enter>
<enter>
n

Here it will give you a link, go ahead and open that on your computer, sign into the google account you want to use and then it will give you a key for example

4/JoTB6qB8Bgrk-i66i9yOIBj1D1234mSM1HTDrDjGw1Y

Go ahead and paste that code (not mine, yours!) into the rclone installer and press

Let's continue:

n
y
q

So, right now we just created a remote called gdrive test.

To test it, now type:

rclone lsd gdrivetest:

Be sure to keep the : at the end, oh, and change it from gdrivetest to whatever you named it.

You should see a list of files on your Google Drive. If so, success!

Now, to put files onto your Google Drive, let's assume you want to copy a folder and it's files from /var/media to a folder on your Google Drive called media, let's do this:

rclone copy /var/media gdrivetest:media

And you've successfully set up rclone with Google Drive :)

Cryptocurrency mining

- Posted in Cryptocurrency by with comments

I have been experimenting with cryptocurrencies for the past month, and I am planning to share my findings here on this blog.

It all started when I was looking at things to do with my 2 dedicated servers while they are idling. I got them for an amazingly low price, $24 USD per month for an i7 and an i5 dedicated server with 2TB HDD in each one. They have been used for Plex and nextCloud, but I'm not always watching Plex nor am I always using nextCloud.

It turns out I could mine on these for a profit, so I did.

I started off by using a portable version of xmrig which is actually no longer available, which I keep here http://dah85.com/xmrig.zip

In there are the config files I use for Monero (XMR), Electroneum (ETN) and Karbo (KRB) along with a few others.

When I started, the difficulty for XMR was a lot lower than it is today and I was making $40/month with 300 hashes per second on the i7 and i5 combined, and this is before I discovered huge pages.

Here's how I mine:

First, do yourself a favor, if you want to mine, turn on huge pages! It actually boosted my overall hashrate to 400h/sec.

sudo sysctl -w vm.nr_hugepages=5

Then secondly, download the xmrig files

wget dah85.com/xmrig.zip ; unzip xmrig.zip

In the xmrig folder you'll see a bunch of config.json.xxx files, each relating to whatever currency I'm mining at the time.

Using the default settings, it would be config.json

I renamed the xmrig to benchmark for reasons that may be best left unsaid at this stage, but feel free to change it back if you like.

Let's edit these files and change the details to yours

nano config.json

You'll see a lot of things, forget most of it, the only things we need to change are the address (wallet) and mining pool used.

One thing to note, is that the best number of threads to use is the amount of CPU cache divided by 2. When you run xmrig it will show you how much cache there is and how many threads are being used, by default it's 75% of the cores - if you have a 4 core machine with 8mb cache then we could use all 4 cores. If that's the case, change "threads: null" to "threads: 4", for example.

I'll write more later, but that would be enough to get you started if you already have a wallet and know which pool you'd like to use.

It's a long-winded title, but it's fitting.

I was trying to work out how to set up VestaCP so that when someone visits the IP of the server, it can go to a specific website instead of the first website that was configured, which in my case, is not desired.

So basically what made me want to do this is there seem to be a lot of domains that are still pointing to my IP and I'd like to capture that traffic and forward them to my web design page just.

What we are going to do is change the order in which VestaCP and Apache will look at websites in this case.

First, we'll edit /etc/apache2/conf.d/vesta.conf

nano /etc/apache2/conf.d/vesta.conf 

Then move the website you want to the top of the list, then save (control+x)

Once you've done that, we need to restart nginx and apache

service apache2 restart
service nginx restart

Now when you go to the website by the IP or a domain that's not hosted by you, it'll forward to the first website in that list. Neat, eh?

Redirecting domains with VestaCP

- Posted in Quick Tip by with comments

I have been looking for a way to redirect domain1.com to domain2.com even if the address is domain1.com/blah/random it will always redirect to domain2.com

We need to make a .htaccess file in the public_html folder and add the following:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain1.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain1.com [NC]
RewriteRule ^(.*)$ http://domain2.com/ [L,R=301,NC]

If we want it to forward them like this, example1.com/blah to example2.com/blah, we'd use:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain1.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain1.com [NC]
RewriteRule ^(.*)$ http://domain2.com/$1 [L,R=301,NC]

In a previous post I spoke about setting up the SSL cert for mail, but the web interface also needs SSL set up. The steps are actually similar, but without the extra bit for mail.

Here's what I did to fix it, just make sure you replace the example with your own domain. If you aren't running as root, use these commands otherwise put sudo in front of them all:

ln -s /home/admin/conf/web/ssl.example.com.pem /usr/local/vesta/ssl/certificate.crt
ln -s /home/admin/conf/web/ssl.example.com.key /usr/local/vesta/ssl/certificate.key

If that didn't do the trick, restart apache and vestacp and it will now work with your new cert :)

Setting up SSL for Mail in VestaCP

- Posted in Quick Tip by with comments

I'm still playing with my VestaCP install, and I've found that the outgoing mail doesn't work correctly when using Thunderbird or any other mail client except webmail which works perfectly.

It turns out there's an issue with the SSL certificates and EXIM (the mail server)

Here's what I did to fix it, just make sure you replace the example with your own domain. If you aren't running as root, use these commands otherwise put sudo in front of them all:

ln -s /home/admin/conf/web/ssl.example.com.pem /usr/local/vesta/ssl/certificate.crt
ln -s /home/admin/conf/web/ssl.example.com.key /usr/local/vesta/ssl/certificate.key

setfacl -m user:Debian-exim:r-- /home/admin/conf/web/ssl.example.com.pem
setfacl -m user:Debian-exim:r-- /home/admin/conf/web/ssl.example.com.key

chgrp mail /home/admin/conf/web/ssl.example.com.pem
chmod 660 /home/admin/conf/web/ssl.example.com.pem
chgrp mail /home/admin/conf/web/ssl.example.com.key
chmod 660 /home/admin/conf/web/ssl.example.com.key

Now you should be able to send email from a mail client without it complaining about certificates :)

Finding the SQL password in VestaCP

- Posted in Quick Tip by with comments

I've been playing with VestaCP lately, getting it all set up the way I like and I had a need to manually edit the databases and found that there was a root password set that I never set.

The password is hidden away in a file, to get to it do this:

sudo nano /usr/local/vesta/conf/mysql.conf

You'll find the password in there :)

VPS roundup

- Posted in VPS by with comments

I have had some people ask me what VPS I use and would recommend. I have decided to round up the best of the best VPS services that I have and still use.

These are the providers that offer the best value for money and I highly recommend using these guys if you're looking for reliable VPS servers.

  • TNAHosting - High RAM (6GB) with powerful cores
  • Wishosting - High storage (1.8TB) with excellent performance, amazing support and unbeatable value!
  • Shock Hosting - Very fast SSD VPS with powerful cores with excellent support and great value.
  • Time4VPS - Insanely good value OpenVZ storage plans starting at 1TB to 4TB, large company with their own datacentre.

Running multiple commands in Bash

- Posted in Quick Tip by with comments

I have found myself often needing to install a couple of different programs on a new server, for example plex and webmin and usually I do these one after the other.

I have found a better way to do this by separating each command with a ; for example:

dpkg -i plexmediaserver_1.9.4.4325-1bf240a65_amd64.deb ; dpkg -i webmin_1.860_all.deb ; apt -f install -y

This allows the commands to run one after another. If you want them to only run if the command before was successful, then you would replace the ; with &&

In my example above, if plex failed to install then webmin would still install. If I replaced the ; with a && then it would quit after plex failed.

I hope that helps someone! :)

Reviewing a KVM VPS from Shock Hosting

- Posted in VPS by with comments

I will be reviewing a VPS from a company called Shock Hosting. They have 2 DC locations to choose from, 1 in New Jersey and the other is in Los Angeles. They have recently updated their plans and I will be looking at this offer:

  • 2 GB DDR4 RAM
  • 30 GB of RAID 10 SSD storage
  • 2 TB of bandwidth
  • 1 x 3.4 Ghz E5-1680 v4 core
  • DDoS protection is also included
  • $7.49 with 25OFF coupon (Normally $9.99/month)

There is also a plan for $4.99 with 20 GB of storage, 1 GB of RAM and 1 TB of bandwidth if you think that would be better.

There is a 25% discount promotion which brings the price down to $7.49 for the 2 GB plan and $3.74 for the 1 GB plan if you use the coupon "25OFF"

Now, let's have a look at some benchmarks:

----------------------------------------------------------------------
CPU model            : Intel(R) Xeon(R) CPU E5-1680 v4 @ 3.40GHz
Number of cores      : 1
CPU frequency        : 3399.996 MHz
Total size of Disk   : 30.0 GB (1.8 GB Used)
Total amount of Mem  : 2000 MB (58 MB Used)
Total amount of Swap : 511 MB (0 MB Used)
System uptime        : 0 days, 0 hour 31 min
Load average         : 0.00, 0.00, 0.00
OS                   : Ubuntu 16.04.3 LTS
Arch                 : x86_64 (64 Bit)
Kernel               : 4.4.0-31-generic
----------------------------------------------------------------------
I/O speed(1st run)   : 1.0 GB/s
I/O speed(2nd run)   : 928 MB/s
I/O speed(3rd run)   : 1.1 GB/s
Average I/O speed    : 1026.1 MB/s
----------------------------------------------------------------------
Node Name                       IPv4 address            Download Speed
CacheFly                        205.234.175.175         104MB/s       
Linode, Tokyo, JP               106.187.96.148          20.4MB/s      
Linode, Singapore, SG           139.162.23.4            5.50MB/s      
Linode, London, UK              176.58.107.39           6.90MB/s      
Linode, Frankfurt, DE           139.162.130.8           4.60MB/s      
Linode, Fremont, CA             50.116.14.9             9.17MB/s      
Softlayer, Dallas, TX           173.192.68.18           45.4MB/s      
Softlayer, Seattle, WA          67.228.112.250          42.2MB/s      
Softlayer, Frankfurt, DE        159.122.69.4            5.97MB/s      
Softlayer, Singapore, SG        119.81.28.170           9.00MB/s      
Softlayer, HongKong, CN         119.81.130.170          9.28MB/s      
----------------------------------------------------------------------
CPU model:  Intel(R) Xeon(R) CPU E5-1680 v4 @ 3.40GHz
Number of cores: 1
CPU frequency:  3399.996 MHz
Total amount of RAM: 2000 MB
Total amount of swap:  MB
I/O speed:  1.1 GB/s
Bzip 25MB: 3.74s
Download 100MB file: 105MB/s
CPU model:  Intel(R) Xeon(R) CPU E5-1680 v4 @ 3.40GHz
Number of cores: 1
CPU frequency:  3399.996 MHz
Total amount of RAM: 2000 MB
Total amount of swap:  MB
I/O speed:  956 MB/s
Bzip 25MB: 3.62s
Download 100MB file: 106MB/s

Pardon the pun, but that I/O is shock-ingly fast! I've never reviewed a VPS that fast! The 3.4ghz CPU core along with that crazy awesome SSD setup makes this VPS feel snappier than a hungry crocodile! 30GB of this awesome SSD is enough to store plenty of assets for your projects or applications. The 2GB of RAM is a nice bonus. I'm honestly really impressed with this!

The network speed is excellent, considering I'm testing this during peak time. Being in the LA datacenter, this has excellent connections to Australia compared with other parts of North America.

It honestly feels like a dedicated server, this is a very well set up server indeed.

I'm going to install Plex and see how it handles transcoding 1080 down to SD, which I find seems to set a good server and an excellent server apart.

plexmediaserver_1.9.4.4325-1bf240a65_amd64.deb                      100%[==================================================================================================================================================================>] 102.82M   110MB/s    in 0.9s    

2017-11-02 05:36:21 (110 MB/s) - ‘plexmediaserver_1.9.4.4325-1bf240a65_amd64.deb’ saved [107815492/107815492]

Off to an excellent start!

Plex is installed and I'm transcoding a 1080 film to SD and it's flawless. Not a single stutter or skip! I did something I don't normally do, I ran another bench while it's transcoding:

CPU model:  Intel(R) Xeon(R) CPU E5-1680 v4 @ 3.40GHz
Number of cores: 1
CPU frequency:  3399.996 MHz
Total amount of RAM: 2000 MB
Total amount of swap:  MB
I/O speed:  687 MB/s
Bzip 25MB: 7.86s
Download 100MB file: 73.5MB/s

This CPU is a monster! It only took a small hit (the Bzip time) down to a very respectable 7.86 seconds which is still very good.

I can honestly say this is the fastest VPS I've had to date, and I even reviewed an i5 dedicated server and this outperforms it!

I highly recommend this VPS to anyone looking for something with huge power, a very generous 30GB of shocking fast SSD on a budget.

Click here to order it, and don't forget to add the 25OFF coupon in the checkout :)