Donate VRC/VRM for the Wiki to VBzaNDExHyFpnNvYc5QH5e4ipBZqxxPnKJ . Thank you, Joe.

Difference between revisions of "Linux"

From VeriCoin & Verium Wiki
Jump to: navigation, search
(Operating System: + package management & sub-head shuffle)
(Usage)
Line 48: Line 48:
 
   ./vericoind getinfo  
 
   ./vericoind getinfo  
 
One important thing is your wallets address gotten by
 
One important thing is your wallets address gotten by
   ./veriumd getaddressesbyaccount ""
+
   ./vericoind getaddressesbyaccount ""
 
Learn how to use the VeriCoin Daemon
 
Learn how to use the VeriCoin Daemon
 
   ./vericoind help
 
   ./vericoind help

Revision as of 17:01, 25 January 2018

This page should provide guideline how to use VeriCoin and Verium on Linux or FreeBSD Systems.

VeriCoin Wallet

Installation


In a Terminal start with an update of your system

 sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -f -y

Install the wallets dependencies:

 sudo apt-get install build-essential libboost-dev libboost-system-dev libboost-filesystem-dev \
      libcurl4-openssl-dev libboost-thread-dev libssl-dev libdb++-dev libboost-program-options-dev \
      libminiupnpc-dev libboost-all-dev libqrencode-dev freeglut3-dev git libminizip-dev -y

Clone the wallet software itself

 git clone https://github.com/vericoin/vericoin.git

Compile the wallet within its source directory

 cd vericoin/src
 make -f makefile.unix

Configuration

Get latest config file with sync nodes

 wget http://www.vericoin.info/downloads/vericoin.conf

Configure daemon

 nano vericoin.conf

scroll to its very end, the lines to configure are

server=1
listen=1
daemon=1
rpcuser=vericoinrpc
rpcpassword=

below the nodes list.

Usage

After the wallets installation we need to go to its directory

 cd vericoin/src

and start the wallet

 ./vericoind 

Get info about its status by:

 ./vericoind getinfo 

One important thing is your wallets address gotten by

  ./vericoind getaddressesbyaccount ""

Learn how to use the VeriCoin Daemon

 ./vericoind help

will print a wall of text with commands and

 ./vericoind help [command]

explains each further. Stopping the wallet

 ./vericoind stop

Some further wallet commands that are interesting.

Security & Backup

Encrypt your wallet by

 $ ./vericoind encryptwallet "YOUR passphrase here :)"
  ^ space

Put a space in front so it doesn't remember it in bash history!

The wallet stores private key information in a file named wallet.dat. It contains:

  • keypairs for each of your addresses
  • transactions done from/to your addresses
  • user preferences
  • default key
  • reserve keys
  • accounts

The wallet.dat file is located in

 ~/.vericoin/

Backup your wallet.dat in a secure place (USB drive, CD, ...).

Linux users of the vericoind make sure to use encryptwallet to excrypt your wallet with a passphrase.

Finally backup by

 cp ~/.verium/wallet.dat somewhere/save/wallet.dat

To restore your wallet just do a fresh installation and replace the new wallet.dat with your saved one.

The most important thing you need to keep backed up is your private keys for your address(s) which are stored in the wallet.dat . Store & Secure both VeriCoin & Verium in One Paper Wallet [Paper Wallet Link]

Troubleshooting

Currently the VeriCoin wallet uses a lot of memory. This is going to be fixed soon, the workaround is to limit the number of connections in

 nano vericoin.conf

by adding

 maxconnections=10

Verium Vault

Installation

Daemon build

Updated for Version 1.1

The whole thing as a script: [Download Shell script] or use

 wget https://raw.githubusercontent.com/DJoeDt/verium/master/install_Verium_Wallet.sh
 chmod +x install_Verium_Wallet.sh
 ./install_Verium_Wallet.sh

It will do what is described in the step-wise Manual Verium Wallet Installation .

In case you see ERRORS like -No such file... - it actually helps to run the script again since probably the installation of some dependencies failed.

Configuration

It is configured in

 nano verium.conf

scroll to its very end, the lines to configure are

rpcuser=YourSoloMiningName
rpcpassword=YourSoloMiningPassword
rpcallowip=YourAccessIP
rpcallowip=localhost

You have to configure the IPs of the machines that should be able to connect. If you mine solo you have to come up with a username and a password for your miners to access the wallet.

Usage

The wallet should run now, but we need to go to its directory

 cd verium/wallet/src

Now start the wallet again

 ./veriumd 

and get info about its status by:

 ./veriumd getinfo 

The most important thing right now is your wallets address gotten by

  ./veriumd getaddressesbyaccount ""

Now stop the wallet

 ./veriumd stop

Learn how to use the Verium Daemon

 ./veriumd help

will print a wall of text with commands and

 ./veriumd help [command]

explains each further.

further wallet commands

Backup

Finally backup by

 cp ~/.verium/wallet.dat somewhere/save/wallet.dat

To restore your wallet just do a fresh installation and replace the new wallet.dat with your saved one.

The most important thing you need to keep backed up is your private keys for your address(s) which are stored in the wallet.dat . Store & Secure both VeriCoin & Verium in One Paper Wallet [Paper Wallet Link]

Backup

The wallet stores private key information in a file named wallet.dat. It contains:

  • keypairs for each of your addresses
  • transactions done from/to your addresses
  • user preferences
  • default key
  • reserve keys
  • accounts

The wallet.dat file is located in

 ~.verium/

Backup your wallet.dat in a secure place (USB drive, CD, ...).

Troubleshooting

How to include the blockchain manually in veriumd:

Download and save in verium subfolder

 wget -O ~/verium/bootstrap_VRM.zip http://www.vericoin.info/downloads/bootstrap_VRM.zip

Unzip it

 cd ~/verium
 unzip bootstrap_VRM.zip

Delete previous files

 rm -rf ~/.verium/txleveldb
 rm -rf ~/.verium/blk0001.dat

Move unzipped files to .verium folder

 mv ~/verium/bootstrap/blk0001.dat ~/.verium/blk0001.dat
 mv ~/verium/bootstrap/txleveldb ~/.verium/txleveldb

Verium Mining

Special Hardware Guides

Mining Software

!linuxguide Thanks to technikpto for this helpful guide! https://vericoinandverium.slack.com/files/U6JB348M6/F7ML8F7JS/install-verium-cpu-miner-linux.pdf.pdf

Install scripts by dominer: I've released a script for installing @fireworm's miner. Until now only for Linux_x64 but ARMv7/v8 will follow later today. Supports GCC 7.2 (fully automatic), compiling or precompiled packages (fully automatic) and magic stuff on hugepages (autocalculated).

git repo

Proxies and Pools

Proxies are a very useful thing for external-to-your-network pool mining farms (swarm of SBCs, for example). Private pools are useful for solo mining farms. Pool software could also be public, I suppose, but what fun is that? Read on.

SOCKS and HTTP

Why SOCKS or HTTP proxy? Suppose your ISP throttles stratum or restricts the UDP port(s) your miners rely on. Have you ever tried to pass stratum through a VPN to get around those restrictions? Your mining software has built-in support for SOCKS4 and HTTP proxies. (Maybe. Unknown if VRM-Vault wallet supports this. Presumably, it does because there's a proxy setting available in Settings->Options->Network. @Devs? Confirm, please.)

Source: effectsToCause/veriumMiner GitHub README

 Connecting through a proxy
 
 Use the --proxy option.
 
 To use a SOCKS proxy, add a socks4:// or socks5:// prefix to the proxy host
 Protocols socks4a and socks5h, allowing remote name resolving, are also available since libcurl 7.18.0.
 
 If no protocol is specified, the proxy is assumed to be a HTTP proxy.
 When the --proxy option is not used, the program honors the http_proxy and all_proxy environment variables.

stratum-proxies

Stratum is a protocol developed for bitcoin mining. As miners got faster, it was discovered pools and even solo nodes were unable to keep up with the work-request demands, leaving hashing hardware idle for significant time periods. It also was found to reduce the amount of network traffic, overall. See Bitcoin wiki stratum protocol entry if you're interested in the history and technical details. All we really need to know is it reduces the strain on our local solo nodes or reduces latency and bandwidth requirements when we mine on a pool.

  • world's first stratum proxy by @slush0 - still maintained! May be limited to the SHA256 mining algorithm and/or BTC-core RPC specific. My research hasn't gotten this far.
  • bfgminer has one built-in - support for Scrypt. Unknown if it supports n-Scrypt. Also a miner of it's own if you want to drive some ASICs or FPGAs in SHA256 or Scrypt algos.
  • proxy in java - unknown which algos are supported or if it's algo agnostic.
  • CryptoManiac's proxy in python. Supports Scrypt. Unknown if it supports n-Scrypt.
  • p4u/stratum-relay This author knows nothing about this software. It appears to be a stratum<->stratum proxy. Not very active development.

Pools

Why run a public pool? So you can be kept awake at night with rude demands of people you don't know and who don't give two s**ts about how much sleep you've had this week, or whether there's enough coin in the pool's hot-wallet for them to make a withdrawal. Oh, and $profit! from fees. :-)

Why a private pool? For easier, single-point of access, monitoring of your swarm of solo miners; duh! Also, most pool software implements stratum which is much friendlier to your node than the inbuilt getwork.

  • Con Kolivas' ckpool It is unknown if this will work with your VRM node. Con Kolivas is a staunch and stalwart supporter of BTC only, so there's a strong chance it does not. However, the author hasn't verified that.
  • Node Open Mining Portal Very popular software with pool managers of a wide variety of algos.
  • YAAMP may no longer be maintained. Last commit at GitHub in 2015...
  • yiimp by Tanguy Pruvot (of cpuminer-multi fame). Fork of YAAMP.

Optimization

Odroid

ODROID Verium Mining Image: Download

  1. Burn it without extracting it (because it's 2 partitions)
  2. On first bootup give it 5-10 mins time until you should be able to find the device in the network.
  3. Log in with standard root/odroid
  4. Then
 nano /etc/rc.local 

For further information visit out special Odroid section.

hugepages

transparent_hugepages


To enable transparent_hugepages type in terminal : echo always | sudo tee /sys/kernel/mm/transparent_hugepage/enabled

To disable transparent_hugepages type in terminal : echo never | sudo tee /sys/kernel/mm/transparent_hugepage/enabled preallocated


IMPORTANT -> To use preallocated in cpuminer you need to disable transparent_hugepages

To enable:

  1. sudo nano /etc/sysctl.conf
  2. scroll to the bottom
  3. type in vm.nr_hugepages=size
  4. Ctrl+O, then [Enter], then Ctrl+X.
  5. sudo sysctl -p

To disable:

  1. sudo nano /etc/sysctl.conf,
  2. scroll to the bottom,
  3. remove the line vm.nr_hugepages=size
  4. Ctrl+O, then [Enter], then Ctrl+X.
  5. sudo sysctl -p

GCC

It was noticed, that using latest GCC version to compile the miner causes hashrate to increase. Default version in Ubuntu 16.04 is GCC 5.4.0. Basic Ubuntu GCC update instructions:

sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:jonathonf/gcc-7.2
sudo apt-get update
sudo apt-get install gcc-7 g++-7

check the version:

gcc --version

update alternatives if needed:

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 60 && sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60

Autostart

rc.local

Autostart configuration:

 sudo nano /etc/rc.local
 # Verium Miner Configuration
/root/verium/nwayminer/cpuminer \
-o stratum+tcp://vrm.n3rd3d.com:3332 -u joe_rondx.1 -p joe \
--no-color >> /root/verium/nwayminer/miner.log &

You must enter the full path to the miner.

crontab

you can follow these steps to make the miner auto start after a reboot: (make a run command that will startup the miner)

 nano run.sh

(add the following line, changing the values to correspond to your pool, account name, miner name, and password)

 ./cpuminer -o pool -u username.miner -p x

ctrl-o to save, ctrl-x to exit (make the run command executable)

 chmod +x run.sh

(create a startup command that is used to automatically start the miner when you reboot your system)

 nano ~/startup.sh

(add the following 2 lines, changing username to your Linux account name)

 cd /home/username/veriumMiner
 ./run.sh > run.out &

(make the startup command executable)

 chmod +x ~/startup.sh

(Tell cron to run startup at reboot)

 crontab -e

(add this as the last line in crontab, changing username to your Linux account name)

 @reboot /home/username/startup.sh 2>&1


systemd

@hillbillyhacker: ok, so i'd recommend just creating a systemd unit file for the wallet then. and then you can use journalctl to see the log output one sec, let me get an example for ya

[Unit]
Description=Veriumd Wallet
Before=nomp.service

[Service]
User=user
ExecStart=/usr/local/bin/veriumd -printtoconsole
ExecStop=/usr/local/bin/veriumd stop
Restart=always

[Install]
WantedBy=multi-user.target

replace user with the user you want to run the wallet as. and update paths to wallet binary of course

place that somewhere like: /etc/systemd/system/veriumd.service

run: sudo systemctl daemon-reload then sudo systemctl <start|stop|status> veriumd.service

to see logs: sudo journalctl --unit veriumd.service

make sure to also enable the service so it starts on boot: sudo systemctl enable veriumd.service


Operating System

 editor's note: this section is going to quickly out-grow the rest of the page. Recommend creating its own page.

Congratulation! You're a nerd! You are a deviant Linux user and probably are on an FBI or CIA watch list. Not that it matters, because you're also into crypto-currencies which gets you onto the terrorist watch lists, anyway, so why worry?

It turns out all of this stuff is important to maximizing your system for mining performance or monitoring your miners or just making your administration easier. However. None of it is really within the purpose and mission of the wiki. This section mostly contains some basic intro/overview text and links to third-party sources for further information. As much as possible, the section authors have tried to link to official documentation or man pages. These, especially man pages, are often hard to decipher and put into effective action. There may or may not eventually be configuration how-to pages added to the wiki, but this page is really not the most appropriate for OS-level tweaks; just wallet and mining software tweaks.

That said, there are people who are very knowledgeable, helpful, and active in the Slack channel. Your distribution (or SBC vendor's) user-forums are also excellent sources for help. Weirdly, remember to check YouTube; it has plenty of good tutorials.

Did I mention the Arch Linux wiki? Go and explore. I doubt there is, anywhere, a better source of technical how-to information for the Linux enthusiast. Just translate the package installation commands into whatever distribution you use.

GUI or Command Line?

Linux has lots of options for user interfaces. You probably want a pretty, graphical interface for your daily-use computer, spending-wallet software, and maybe also the machine you monitor your mining rigs with and/or your cluster's edge server.

But, if you run a GUI on mining rigs, that GUI is using resources your mining software probably wants for itself. Mining rigs should be kept lean and mean, like a top-fuel dragster or Formula One race car. Unless you're just hobby mining during the day while you're away at work or at night while you sleep. A dedicated mining rig wants a command line shell for a user interface.

Everyone's use-case for their hardware is different. Everyone makes different trade-offs in performance vs. maintainability. Every machine is unique; even the individual slave nodes in your cluster, if you have one.

-- GUI Options

GNOME and KDE are the big kids on the block. They also require the most memory, CPU, and graphical processing power. Lighter weight options like Budgie and LXDE and XFCE also are common desktop environments. If you don't already have a favorite, Wikipedia's list of DEs can help you.

Personally, I recommend you stay away from any of these for a server. No need to waste the resources. If you need to use GUI applications, there are plenty of lighter weight options than full-blown desktop environments. Get out your favorite search engine and look up "tiling window manager". You'll find such wonderful names as 'ratpoison' and 'awesome.' Go ahead. Try them out in a VM to find one you like.

emacs fans will no doubt poo-poo the lightweight GUI thing, and just use emacs for everything. More. Power. To you. Just remember: evil-mode is your friend. :)

-- Command Shells

bash. fish. zsh. ksh. What? That list reads like action pop-outs in a comic book. These are names of command-line shell environments. Each one has a different set of built-in utility functions. Each has different scripting functionality and configuration options. Yes, you read that right: configuration options. A shell environment can be a very personal space.

Most Linux distributions currently ship with and default to bash. It's a solid general purpose shell environment. That doesn't make it the best shell environment. Most Linux users never use anything else.

If you find yourself doing lots of work in the command shell, or writing lots of shell scripts, do yourself a favor and familiarize yourself with the features of other shells. Future-you will thank current/past-you for doing so.

All that being said, this is where you want your mining rigs. A basic shell environment is the lowest resource-use human interface available. If you're mining, there's a good chance you'll spend a bunch of time here. If you have a cluster of miners or want to make a cluster of your current swarm of individuals, you're going spend time here.

Settle in. Get comfortable.

Now you've done that, look into various multi-shell management programs. They also are very light on system resources. They can save your bacon when trying to several things at once across a ssh session from halfway around the world, or from across the room.

GNU's screen utility (quick reference) comes preinstalled on most distributions. It's a solid performer, but it has limitations. tmux (quick reference) is a more modern - well, less OLD - option. It is only sometimes preinstalled. There are other options. Search for "terminal multiplexer".

-- Text Editors

Why, you might ask, is this even here? You might think text editors are boring. You'd be wrong. Did you know, there are people who happily shell out $300, or more, for their favorite MacOS, Windows, and even -gasp!- Linux text editor???

As a Linux user, you're going to be using a text editor a lot. Way more than the average Windows or Mac person. Most configuration is done, or can be done, by editing text files.

Text. Plaintext. Markdown. ReSructuredText. Asciidoc. HTML. XML. json. Docbook. LaTeX. epub. All of these are plain-old, boring text; and that's a very short list of text formats. There's a *very long* list of different textual-format file types. Text is king, and for good reason: text is very easy, bordering on trivial, to search and parse programmatically. That's why it's used for configuration files. And config files are part of why you'll spend so much time in a text editor.

There are some really good graphical text editors; Atom, Gedit and Sublime Text are three of the most popular. They're pretty. They're featureful. They're configurable - some more than others. But they aren't available in the shell, over an ssh connection. For that, you want something different.

Your Linux distribution probably ships with nano and vi. Of the two, vi is the more featureful, but it also has a steep (REALLY steep) learning curve. vi is absolutely, always, available on EVERY Linux, BSD or other UNIX -based computer unless specifically and intentionally removed (sometimes with malice) by the sysadmin. That's not the case with nano. You should get familiar with the bare basics of using vi.

vim is an upgrade to vi. It has the same commands. It's extremely configurable. It can be scripted (has its own scripting language) and millions of users swear by it. It might be, but probably isn't, preinstalled on your distribution.

emacs is almost never preinstalled on a system; which is a shame. It is, arguably, the most capable program available on Linux or BSD. It's a supremely capable, configurable, scriptable text editor. It has a built-in web browser, email client, news reader, note taker, and more. It also has a very steep learning curve.

The vim/emacs war (which is better?) continues to rage. Ultimately, emacs is more capable and easier to script - or, at least, easier to debug those scripts. It has a mode, called EviL (not installed by default; ever), which implements vi/m-like commands.

Learn the basics of vi/m. Really. Just do it.

System Administration

Just the basics, here.

Package Management

Each Linux distribution has a different scheme for managing installation and removal of software, collectively referred to as 'packages.' Most distributions use apt or rpm. There are others, some of which are gaining ground cross-distribution.

If you have a Debian-based distribution, your package manager is apt. Your command-line packaging commands will mostly all be something similar to apt [some command] [some package name or list of names] [optional arguments].

If you have a Red Hat -based distribution (RHEL, CentOS, Fedora), your package manager is rpm. Confusingly, your command-line packaging commands will mostly all be similar to yum [some command] [optional arguments] [some package name or list of names].

These are the two most common package management systems in the Linux world. There are others. Arch has pacman. Slackware use pkgtool. Gentoo has emerge. The BSD and Solaris (UNIX, not Linux) systems have pkg and ports. Be sure to check your distro's documentation to learn how to use the package manager.

A relatively new, cross-distribution packaging system has gained some popularity: snap. Snap comes preinstalled on Ubuntu 16.04 and newer, but may also be preinstalled on other distros. If it's not preinstalled, and you want to use it, it's available in most package repositories.

Speaking of repositories... Your package manager gets all its package data, and often the packages themselves, from a centralized package repository somewhere out in internet-land. Repository management is also something you'll undoubtedly be required to do some of. Again, check your distro's documentation on how to go about doing this.

If you use a graphical package manager (GNOME Software, for example), much of this is hidden from you. If you're compiling mining software or wallets, you'll need to know the basics of package management in the terminal (command line.)

Basic Networking

  • nmTUI
  • avahi
  • /etc/hosts & /etc/hostname
  • etc. (advanced networking in Clustering)

Security & Hardening

  • PAM
  • firewalls (ufw and iptables are most common?)
  • intrusion detection and resistance (fail2ban ?)
  • SSH basics (save advance usage for Clustering section)
  • user/group permissions
  • jail and container intro (more detail in own section)
  • etc.

Backup, Fail-Over, & Disaster Recovery

  • backups
  • disk & system images

Remote Administration

  • basic ssh
  • scp
  • VNC and RDP
  • webmin and other resources

Advanced Topics

Clustering

  • webmin Cluster modules
  • ansible, chef, etc.
  • SSH, pSSH, SSHfs, gpg-key passwordless logins
  • NFS
  • PXE-booting (not supported most SBCs, but definitely supported most servers)
  • More advanced networking: DNS, DHCP, NTP, NAT (?)
  • see Containers and Virtual Machines

Containers and Virtual Machines

  • Pros, Cons of containers vs. VMs vs. bare metal
  • Available container technologies, pros/cons of each
    • lxc (personal favorite)
    • Docker
    • BSD jails
    • snapd containerized user-space applications
    • Management and provisioning tools (virt-engine, swarm, kubernetes, etc)
  • Available VMs, pros/cons of each
    • KVM
    • VMware/Vagrant
    • VirtualBox
    • Management and provisioning tools (virt-engine, swarm, kubernetes, etc)

Tuning and Pruning

Getting the leanest, meanest OS you can still make use of.

  • proprietary drivers


Hardware Control and Tuning

  • BIOS tweaks, upgrades
  • fan speed control
  • CPU throttling, overclocking and heat!
  • RAM throttling, overclocking and heat!
  • swap and swappiness
  • RAM-disks
  • HDD tuning - platters and SSDs
  • DRM and another GPU-related intro article (link to external resource for more depth)
  • PSU sizing for maximum reliability and longevity
  • battery backup and graceful shutdown (also sizing the battery)