Как стать автором
Обновить

Вливаемся в tox-сообщество или установка ноды за 5 минут

Время на прочтение24 мин
Количество просмотров32K
Приветствую тебя, о жадный читатель, буквоед и борец за справедливость в интернетах! В нашей оружейной пополнение, называется оно tox. Сейчас я покажу тебе, %username%, его сборку-разборку.

debian_tox_dht

Есть такая замечательная система, которая называется TOX. Вот их официальный сайт, а вот профиль на github.

О tox уже писали множество раз, но я перечислю основные плюшки: DHT — нет зависимости от центрального сервера, достаточно хотя бы одной ноды, шифрование на клиенте — Вася пишет Маше, telegram Паша ничего не прочитает.


Есть три варианта установки:
  1. ручная сборка и конфигурирование, с описанием этапов (рассмотрено в статье ниже)
  2. автоматическая сборка и конфигурирование скриптом, предложенным ksenobayt (новая версия)
  3. установка из пакетов, найденных Darka (конфигурация «по-умолчанию». Пример, как править конфиг можно найти в этой статье)


Итак, для начала качаем toxcore с гитхаба: https://github.com/irungentoo/toxcore/archive/master.zip, распаковываем.

Установка расписана в официальной документации:

Именно на основе указанных выше страниц и был написан этот туториал и запущена нода.

Сие настроено и успешно работает на:

root@l64tox1:~# uname -a
Linux l64tox1 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u1 (2015-12-14) x86_64 GNU/Linux


Заходим в папку.

root@l64tox1:/usr/tox# cd toxcore-master


Что мы там видим:

root@l64tox1:/usr/tox/toxcore-master# l
total 164
-rwxr-xr-x 1 root root    68 Dec 16 23:22 autogen.sh
drwxr-xr-x 2 root root  4096 Dec 16 23:22 auto_tests
drwxr-xr-x 2 root root  4096 Dec 16 23:22 build
-rw-r--r-- 1 root root 20610 Dec 16 23:22 configure.ac
-rw-r--r-- 1 root root 35147 Dec 16 23:22 COPYING
drwxr-xr-x 2 root root  4096 Dec 16 23:22 dist-build
drwxr-xr-x 3 root root  4096 Dec 16 23:22 docs
-rw-r--r-- 1 root root   241 Dec 16 23:22 DONATORS
-rw-r--r-- 1 root root   662 Dec 16 23:22 .gitignore
-rw-r--r-- 1 root root 19317 Dec 16 23:22 INSTALL.md
-rw-r--r-- 1 root root   235 Dec 16 23:22 libtoxav.pc.in
-rw-r--r-- 1 root root   341 Dec 16 23:22 libtoxcore.pc.in
drwxr-xr-x 2 root root  4096 Dec 16 23:22 m4
-rw-r--r-- 1 root root   877 Dec 16 23:22 Makefile.am
drwxr-xr-x 6 root root  4096 Dec 16 23:22 other
-rw-r--r-- 1 root root  2524 Dec 16 23:22 README.md
drwxr-xr-x 2 root root  4096 Dec 16 23:22 super_donators
drwxr-xr-x 2 root root  4096 Dec 16 23:22 testing
drwxr-xr-x 2 root root  4096 Dec 16 23:22 toxav
drwxr-xr-x 2 root root  4096 Dec 16 23:22 toxcore
drwxr-xr-x 2 root root  4096 Dec 16 23:22 toxdns
drwxr-xr-x 3 root root  4096 Dec 16 23:22 toxencryptsave
-rw-r--r-- 1 root root  1505 Dec 16 23:22 tox.spec.in
-rw-r--r-- 1 root root  1698 Dec 16 23:22 .travis.yml


Устанавливаем библиотеки:

apt-get install build-essential libtool autotools-dev automake checkinstall check git yasm libsodium13 libsodium-dev


и

apt-get install libconfig-dev


Запускаем autogen.sh:

root@l64tox1:/usr/tox/toxcore-master# ./autogen.sh
Running autoreconf -if...
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `configure_aux'.
libtoolize: copying file `configure_aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
configure.ac:291: installing 'configure_aux/ar-lib'
configure.ac:212: installing 'configure_aux/compile'
configure.ac:292: installing 'configure_aux/config.guess'
configure.ac:292: installing 'configure_aux/config.sub'
configure.ac:9: installing 'configure_aux/install-sh'
configure.ac:9: installing 'configure_aux/missing'
build/Makefile.am: installing 'configure_aux/depcomp'
parallel-tests: installing 'configure_aux/test-driver'


Запускаем конфигуратор и оживляем демона (--enable-daemon):
./configure --enable-daemon
root@l64tox1:/usr/tox/toxcore-master# ./configure --enable-daemon
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '0' is supported by ustar format... yes
checking whether GID '0' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether make supports nested variables... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking linux/version.h usability... yes
checking linux/version.h presence... yes
checking for linux/version.h... yes
checking for Linux epoll(7) interface... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... dlltool
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for crypto_pwhash_scryptsalsa208sha256 in -lsodium... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking sodium.h usability... yes
checking sodium.h presence... yes
checking for sodium.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for int16_t... yes
checking for int32_t... yes
checking for pid_t... yes
checking for size_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uint8_t... yes
checking whether byte ordering is bigendian... no
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for gettimeofday... yes
checking for memset... yes
checking for socket... yes
checking for strchr... yes
checking for malloc... yes
checking for clock_gettime in -lrt... yes
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking for pthread_self in -lpthread... yes
checking for OPUS... no
configure: WARNING: disabling AV support No package 'opus' found
checking for CHECK... yes
checking for LIBCONFIG... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating build/Makefile
config.status: creating libtoxcore.pc
config.status: creating tox.spec
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands



Компилируем и прогоняем тесты. Тесты могут занят до 5 минут.
make check
root@l64tox1:/usr/tox/toxcore-master# make check
make  check-recursive
make[1]: Entering directory '/usr/tox/toxcore-master'
Making check in build
make[2]: Entering directory '/usr/tox/toxcore-master/build'
  CC       ../toxcore/libtoxcore_la-DHT.lo
  CC       ../toxcore/libtoxcore_la-network.lo
  CC       ../toxcore/libtoxcore_la-crypto_core.lo
  CC       ../toxcore/libtoxcore_la-ping_array.lo
  CC       ../toxcore/libtoxcore_la-net_crypto.lo
  CC       ../toxcore/libtoxcore_la-friend_requests.lo
  CC       ../toxcore/libtoxcore_la-LAN_discovery.lo
  CC       ../toxcore/libtoxcore_la-friend_connection.lo
  CC       ../toxcore/libtoxcore_la-Messenger.lo
  CC       ../toxcore/libtoxcore_la-ping.lo
  CC       ../toxcore/libtoxcore_la-tox.lo
  CC       ../toxcore/libtoxcore_la-util.lo
  CC       ../toxcore/libtoxcore_la-group.lo
  CC       ../toxcore/libtoxcore_la-assoc.lo
  CC       ../toxcore/libtoxcore_la-onion.lo
  CC       ../toxcore/libtoxcore_la-logger.lo
  CC       ../toxcore/libtoxcore_la-onion_announce.lo
  CC       ../toxcore/libtoxcore_la-onion_client.lo
  CC       ../toxcore/libtoxcore_la-TCP_client.lo
  CC       ../toxcore/libtoxcore_la-TCP_server.lo
  CC       ../toxcore/libtoxcore_la-TCP_connection.lo
  CC       ../toxcore/libtoxcore_la-list.lo
  CCLD     libtoxcore.la
  CC       ../toxdns/libtoxdns_la-toxdns.lo
  CCLD     libtoxdns.la
  CC       ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/libtoxencryptsave_la-pbkdf2-sha256.lo
  CC       ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/libtoxencryptsave_la-pwhash_scryptsalsa208sha256.lo
  CC       ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/libtoxencryptsave_la-utils.lo
  CC       ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/libtoxencryptsave_la-crypto_scrypt-common.lo
  CC       ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/libtoxencryptsave_la-runtime.lo
  CC       ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/libtoxencryptsave_la-scrypt_platform.lo
  CC       ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/nosse/libtoxencryptsave_la-pwhash_scryptsalsa208sha256_nosse.lo
  CC       ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/sse/libtoxencryptsave_la-pwhash_scryptsalsa208sha256_sse.lo
  CC       ../toxencryptsave/libtoxencryptsave_la-toxencryptsave.lo
  CCLD     libtoxencryptsave.la
  CC       ../other/DHT_bootstrap-DHT_bootstrap.o
  CCLD     DHT_bootstrap
  CC       ../other/bootstrap_daemon/tox_bootstrapd-tox-bootstrapd.o
  CCLD     tox-bootstrapd
  CC       ../testing/DHT_test-DHT_test.o
  CCLD     DHT_test
  CC       ../testing/Messenger_test-Messenger_test.o
  CCLD     Messenger_test
  CC       ../testing/dns3_test-dns3_test.o
  CCLD     dns3_test
  CC       ../testing/tox_sync-tox_sync.o
  CCLD     tox_sync
  CC       ../testing/tox_shell-tox_shell.o
  CCLD     tox_shell
  CC       ../testing/irc_syncbot-irc_syncbot.o
  CCLD     irc_syncbot
make  encryptsave_test messenger_autotest crypto_test network_test assoc_test onion_test TCP_test tox_test dht_autotest
make[3]: Entering directory '/usr/tox/toxcore-master/build'
  CC       ../auto_tests/encryptsave_test-encryptsave_test.o
  CCLD     encryptsave_test
  CC       ../auto_tests/messenger_autotest-messenger_test.o
  CCLD     messenger_autotest
  CC       ../auto_tests/crypto_test-crypto_test.o
  CCLD     crypto_test
  CC       ../auto_tests/network_test-network_test.o
  CCLD     network_test
  CC       ../auto_tests/assoc_test-assoc_test.o
  CCLD     assoc_test
  CC       ../auto_tests/onion_test-onion_test.o
  CCLD     onion_test
  CC       ../auto_tests/TCP_test-TCP_test.o
  CCLD     TCP_test
  CC       ../auto_tests/tox_test-tox_test.o
  CCLD     tox_test
  CC       ../auto_tests/dht_autotest-dht_test.o
  CCLD     dht_autotest
make[3]: Leaving directory '/usr/tox/toxcore-master/build'
make  check-TESTS
make[3]: Entering directory '/usr/tox/toxcore-master/build'
make[4]: Entering directory '/usr/tox/toxcore-master/build'
PASS: encryptsave_test
PASS: messenger_autotest
PASS: crypto_test
PASS: network_test
PASS: assoc_test
PASS: onion_test
PASS: TCP_test
PASS: tox_test
PASS: dht_autotest
make[5]: Entering directory '/usr/tox/toxcore-master/build'
make[5]: Nothing to be done for 'all'.
make[5]: Leaving directory '/usr/tox/toxcore-master/build'
============================================================================
Testsuite summary for tox 0.0.0
============================================================================
# TOTAL: 9
# PASS:  9
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[4]: Leaving directory '/usr/tox/toxcore-master/build'
make[3]: Leaving directory '/usr/tox/toxcore-master/build'
make[2]: Leaving directory '/usr/tox/toxcore-master/build'
make[2]: Entering directory '/usr/tox/toxcore-master'
make[2]: Nothing to be done for 'check-am'.
make[2]: Leaving directory '/usr/tox/toxcore-master'
make[1]: Leaving directory '/usr/tox/toxcore-master'



Устанавливаем: с make install или checkinstall. Лучше с checkinstall, вот почему: http://habrahabr.ru/post/130868/
make install
root@l64tox1:/usr/tox/toxcore-master# make install
make  install-recursive
make[1]: Entering directory '/usr/tox/toxcore-master'
Making install in build
make[2]: Entering directory '/usr/tox/toxcore-master/build'
make[3]: Entering directory '/usr/tox/toxcore-master/build'
 /bin/mkdir -p '/usr/local/lib'
 /bin/bash ../libtool   --mode=install /usr/bin/install -c   libtoxcore.la libtoxdns.la libtoxencryptsave.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libtoxcore.so.0.0.0 /usr/local/lib/libtoxcore.so.0.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libtoxcore.so.0.0.0 libtoxcore.so.0 || { rm -f libtoxcore.so.0 && ln -s libtoxcore.so.0.0.0 libtoxcore.so.0; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libtoxcore.so.0.0.0 libtoxcore.so || { rm -f libtoxcore.so && ln -s libtoxcore.so.0.0.0 libtoxcore.so; }; })
libtool: install: /usr/bin/install -c .libs/libtoxcore.lai /usr/local/lib/libtoxcore.la
libtool: install: warning: relinking `libtoxdns.la'
libtool: install: (cd /usr/tox/toxcore-master/build; /bin/bash /usr/tox/toxcore-master/libtool  --silent --tag CC --mode=relink gcc -I.. -I../toxcore -pthread -g -O2 -version-info 0:0:0 -lm -lrt -o libtoxdns.la -rpath /usr/local/lib ../toxdns/libtoxdns_la-toxdns.lo libtoxcore.la -lsodium )
libtool: install: /usr/bin/install -c .libs/libtoxdns.so.0.0.0T /usr/local/lib/libtoxdns.so.0.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libtoxdns.so.0.0.0 libtoxdns.so.0 || { rm -f libtoxdns.so.0 && ln -s libtoxdns.so.0.0.0 libtoxdns.so.0; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libtoxdns.so.0.0.0 libtoxdns.so || { rm -f libtoxdns.so && ln -s libtoxdns.so.0.0.0 libtoxdns.so; }; })
libtool: install: /usr/bin/install -c .libs/libtoxdns.lai /usr/local/lib/libtoxdns.la
libtool: install: warning: relinking `libtoxencryptsave.la'
libtool: install: (cd /usr/tox/toxcore-master/build; /bin/bash /usr/tox/toxcore-master/libtool  --silent --tag CC --mode=relink gcc -I.. -I../toxcore -pthread -g -O2 -version-info 0:0:0 -lm -lrt -o libtoxencryptsave.la -rpath /usr/local/lib ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/libtoxencryptsave_la-pbkdf2-sha256.lo ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/libtoxencryptsave_la-pwhash_scryptsalsa208sha256.lo ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/libtoxencryptsave_la-utils.lo ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/libtoxencryptsave_la-crypto_scrypt-common.lo ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/libtoxencryptsave_la-runtime.lo ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/libtoxencryptsave_la-scrypt_platform.lo ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/nosse/libtoxencryptsave_la-pwhash_scryptsalsa208sha256_nosse.lo ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/sse/libtoxencryptsave_la-pwhash_scryptsalsa208sha256_sse.lo ../toxencryptsave/libtoxencryptsave_la-toxencryptsave.lo libtoxcore.la -lsodium )
libtool: install: /usr/bin/install -c .libs/libtoxencryptsave.so.0.0.0T /usr/local/lib/libtoxencryptsave.so.0.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libtoxencryptsave.so.0.0.0 libtoxencryptsave.so.0 || { rm -f libtoxencryptsave.so.0 && ln -s libtoxencryptsave.so.0.0.0 libtoxencryptsave.so.0; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libtoxencryptsave.so.0.0.0 libtoxencryptsave.so || { rm -f libtoxencryptsave.so && ln -s libtoxencryptsave.so.0.0.0 libtoxencryptsave.so; }; })
libtool: install: /usr/bin/install -c .libs/libtoxencryptsave.lai /usr/local/lib/libtoxencryptsave.la
libtool: install: /usr/bin/install -c .libs/libtoxcore.a /usr/local/lib/libtoxcore.a
libtool: install: chmod 644 /usr/local/lib/libtoxcore.a
libtool: install: ranlib /usr/local/lib/libtoxcore.a
libtool: install: /usr/bin/install -c .libs/libtoxdns.a /usr/local/lib/libtoxdns.a
libtool: install: chmod 644 /usr/local/lib/libtoxdns.a
libtool: install: ranlib /usr/local/lib/libtoxdns.a
libtool: install: /usr/bin/install -c .libs/libtoxencryptsave.a /usr/local/lib/libtoxencryptsave.a
libtool: install: chmod 644 /usr/local/lib/libtoxencryptsave.a
libtool: install: ranlib /usr/local/lib/libtoxencryptsave.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /bin/mkdir -p '/usr/local/bin'
  /bin/bash ../libtool   --mode=install /usr/bin/install -c DHT_bootstrap tox-bootstrapd '/usr/local/bin'
libtool: install: /usr/bin/install -c .libs/DHT_bootstrap /usr/local/bin/DHT_bootstrap
libtool: install: /usr/bin/install -c .libs/tox-bootstrapd /usr/local/bin/tox-bootstrapd
 /bin/mkdir -p '/usr/local/include/tox'
 /usr/bin/install -c -m 644 ../toxcore/tox.h ../toxcore/tox_old.h '/usr/local/include/tox'
 /bin/mkdir -p '/usr/local/include/tox'
 /usr/bin/install -c -m 644 ../toxdns/toxdns.h '/usr/local/include/tox'
 /bin/mkdir -p '/usr/local/include/tox'
 /usr/bin/install -c -m 644 ../toxencryptsave/toxencryptsave.h '/usr/local/include/tox'
make[3]: Leaving directory '/usr/tox/toxcore-master/build'
make[2]: Leaving directory '/usr/tox/toxcore-master/build'
make[2]: Entering directory '/usr/tox/toxcore-master'
make[3]: Entering directory '/usr/tox/toxcore-master'
make[3]: Nothing to be done for 'install-exec-am'.
 /bin/mkdir -p '/usr/local/lib/pkgconfig'
 /usr/bin/install -c -m 644 ./libtoxcore.pc '/usr/local/lib/pkgconfig'
make[3]: Leaving directory '/usr/tox/toxcore-master'
make[2]: Leaving directory '/usr/tox/toxcore-master'
make[1]: Leaving directory '/usr/tox/toxcore-master'



Добавляем юзера tox-bootstrapd, под которым все будет работать, и копируем файл конфигурации:

useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment "TOX DHT bootstrap daemon" --user-group tox-bootstrapd
chmod 700 /var/lib/tox-bootstrapd
cp tox-bootstrapd.conf /etc/tox-bootstrapd.conf
cp other/bootstrap_daemon/tox-bootstrapd.conf /etc/tox-bootstrapd.conf


Редактируем этот файл:

vi /etc/tox-bootstrapd.conf


enable_lan_discovery = true — у нас сервер, и он в ДЦ (а то и виртуалка на нем же!). Так что нет смысла бустить ноды в локалке, меняем true на false.
tcp_relay_ports = [443, 3389, 33445] — порты, на которые отвечает наша нода. То есть если у вы сменили порт ноды по умолчанию на port = 12345 вместо port = 33445, то ваша нода будет работать на порту 12345 и обслуживать порты 443, 3389 и 33445, при включенном enable_tcp_relay = true. В моем случае я оставил enable_tcp_relay = true и указал tcp_relay_ports = [12345, 33445].

enable_motd = true — motd (Message Of The Day), при значении true отдаст первые 255 символов из motd, то есть если у вас motd = "Vive le TOX", то субъект, запросивший motd получит Vive le TOX

Так как мы работаем в DHT и мы очень-очень хотим поддержать tox, то добавляем в конец файла к разделу bootstrap_nodes следующий код. Это все текущие ноды, взятые с их wiki.

bootstrap_nodes
bootstrap_nodes = (
### tox.0x10k.com/bootstrapd-conf/

  {
    #1 [DE] - sonOfRa
    address = "144.76.60.215"
    port = 33445
    public_key = "04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F"
  },
  {
    #2 [US] - stal
    address = "23.226.230.47"
    port = 33445
    public_key = "A09162D68618E742FFBCA1C2C70385E6679604B2D80EA6E84AD0996A1AC8A074"
  },
  {
    #3 [FR] - Munrek
    address = "195.154.119.113"
    port = 33445
    public_key = "E398A69646B8CEACA9F0B84F553726C1C49270558C57DF5F3C368F05A7D71354"
  },
  {
    #4 [US] - nurupo (nurupo.contributions@gmail.com)
    address = "198.46.138.44"
    port = 33445
    public_key = "F404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67"
  },
  {
    #5 [DE] - Martin Schröder
    address = "46.38.239.179"
    port = 33445
    public_key = "F5A1A38EFB6BD3C2C8AF8B10D85F0F89E931704D349F1D0720C3C4059AF2440A"
  },
  {
    #6 [NL] - Impyy
    address = "178.62.250.138"
    port = 33445
    public_key = "788236D34978D1D5BD822F0A5BEBD2C53C64CC31CD3149350EE27D4D9A2F9B6B"
  },
  {
    #7 [DE] - Manolis
    address = "130.133.110.14"
    port = 33445
    public_key = "461FA3776EF0FA655F1A05477DF1B3B614F7D6B124F7DB1DD4FE3C08B03B640F"
  },
  {
    #8 [CA] - noisykeyboard
    address = "104.167.101.29"
    port = 33445
    public_key = "5918AC3C06955962A75AD7DF4F80A5D7C34F7DB9E1498D2E0495DE35B3FE8A57"
  },
  {
    #9 [US] - Busindre
    address = "205.185.116.116"
    port = 33445
    public_key = "A179B09749AC826FF01F37A9613F6B57118AE014D4196A0E1105A98F93A54702"
  },
  {
    #10 [US] - Busindre
    address = "198.98.51.198"
    port = 33445
    public_key = "1D5A5F2F5D6233058BF0259B09622FB40B482E4FA0931EB8FD3AB8E7BF7DAF6F"
  },
  {
    #11 [LV] - fUNKIAM
    address = "80.232.246.79"
    port = 33445
    public_key = "CF6CECA0A14A31717CC8501DA51BE27742B70746956E6676FF423A529F91ED5D"
  },
  {
    #12 [NL] - ray65536
    address = "108.61.165.198"
    port = 33445
    public_key = "8E7D0B859922EF569298B4D261A8CCB5FEA14FB91ED412A7603A585A25698832"
  },
  {
    #13 [GB] - Kr9r0x
    address = "212.71.252.109"
    port = 33445
    public_key = "C4CEB8C7AC607C6B374E2E782B3C00EA3A63B80D4910B8649CCACDD19F260819"
  },
  {
    #14 [SI] - fluke571
    address = "194.249.212.109"
    port = 33445
    public_key = "3CEE1F054081E7A011234883BC4FC39F661A55B73637A5AC293DDF1251D9432B"
  },
  {
    #15 [UA] - MAH69K
    address = "185.25.116.107"
    port = 33445
    public_key = "DA4E4ED4B697F2E9B000EEFE3A34B554ACD3F45F5C96EAEA2516DD7FF9AF7B43"
  },
  {
    #16 [CA] - WIeschie
    address = "192.99.168.140"
    port = 33445
    public_key = "6A4D0607A296838434A6A7DDF99F50EF9D60A2C510BBF31FE538A25CB6B4652F"
  },
  {
    #17 [DE] - clearmartin
    address = "46.101.197.175"
    port = 443
    public_key = "CD133B521159541FB1D326DE9850F5E56A6C724B5B8E5EB5CD8D950408E95707"
  },
  {
    #18 [SE] - Rotkaermota
    address = "95.215.46.114"
    port = 33445
    public_key = "5823FB947FF24CF83DDFAC3F3BAA18F96EA2018B16CC08429CB97FA502F40C23"
  },
  {
    #19 [DE] - tastytea
    address = "5.189.176.217"
    port = 5190
    public_key = "2B2137E094F743AC8BD44652C55F41DFACC502F125E99E4FE24D40537489E32F"
  },
  {
    #20 [DE] - pucetox (1D1C0B992DEB6D7F18561176F7F5E572BCC7F2BA5CFA7E9E437B9134122CE96D906A6119F9D2)
    address = "148.251.23.146"
    port = 2306
    public_key = "7AED21F94D82B05774F697B209628CD5A9AD17E0C073D9329076A4C28ED28147"
  },
  {
    #21 [US] - ru_maniac (EBD2A7B649ABB10ED9F47E5113F04000F39D46F087CEB62FCCE1069471FD6915256D197F2A97)
    address = "104.223.122.15"
    port = 33445
    public_key = "0FB96EEBFB1650DDB52E70CF773DDFCABE25A95CC3BB50FC251082E4B63EF82A"
  },
  {
    #22 [DE] - Deliran
    address = "78.47.114.252"
    port = 33445
    public_key = "1C5293AEF2114717547B39DA8EA6F1E331E5E358B35F9B6B5F19317911C5F976"
  },
  {
    #23 [RU] - D4rk4 (35EDC07AEB18B163E07EE33F6CDDA63969F394FF6A617CEAB22A7EBBEAAAF854C0EDFBD46898)
    address = "83.137.53.211"
    port = 1813
    public_key = "53737F6D47FA6BD2808F378E339AF45BF86F39B64E79D6D491C53A1D522E7039"
  },
  {
    #24 [NL] - tibietigni (D36CC0B702621F48FDBC540A57124A744E5133C932E65ACCEBCABF2586A02455171717175989)
    address = "81.4.110.149"
    port = 33445
    public_key = "9E7BD4793FFECA7F32238FA2361040C09025ED3333744483CA6F3039BFF0211E"
  },
  {
    #25 [RU] - Igor Novgorodov
    address = "95.31.20.151"
    port = 33445
    public_key = "9CA69BB74DE7C056D1CC6B16AB8A0A38725C0349D187D8996766958584D39340"
  },
  {
    #26 [CA] - wildermesser
    address = "104.233.104.126"
    port = 33445
    public_key = "EDEE8F2E839A57820DE3DA4156D88350E53D4161447068A3457EE8F59F362414"
  },
  {
    #27 [FR] - a68366
    address = "51.254.84.212"
    port = 33445
    public_key = "AEC204B9A4501412D5F0BB67D9C81B5DB3EE6ADA64122D32A3E9B093D544327D"
  },
  {
    #28 [BR] - umgeher
    address = "179.35.206.22"
    port = 33445
    public_key = "188E072676404ED833A4E947DC1D223DF8EFEBE5F5258573A236573688FB9761"
  },
  {
    #29 [FR] - Skey
    address = "5.135.59.163"
    port = 33445
    public_key = "2D320F971EF2CA18004416C2AAE7BA52BF7949DB34EA8E2E21AF67BD367BE211"
  },
  {
    #30 [RU] - ru_maniac (EBD2A7B649ABB10ED9F47E5113F04000F39D46F087CEB62FCCE1069471FD6915256D197F2A97)
    address = "185.58.206.164"
    port = 33445
    public_key = "24156472041E5F220D1FA11D9DF32F7AD697D59845701CDD7BE7D1785EB9DB39"
  }
)



Теперь копируем скрипт для нашего демона в init.d, и даем ему права на запуск и запускаем!

cp other/bootstrap_daemon/tox-bootstrapd.sh /etc/init.d/tox-bootstrapd
chmod 755 /etc/init.d/tox-bootstrapd
update-rc.d tox-bootstrapd defaults
service tox-bootstrapd start


Проверяем, как оно работает:

root@l64tox1:~# service tox-bootstrapd status
● tox-bootstrapd.service - LSB: Starts the Tox DHT bootstrapping server daemon
   Loaded: loaded (/etc/init.d/tox-bootstrapd)
   Active: active (running) since Wed 2015-12-23 17:12:53 CET; 13min ago
  Process: 396 ExecStart=/etc/init.d/tox-bootstrapd start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/tox-bootstrapd.service
           └─436 /usr/local/bin/tox-bootstrapd /etc/tox-bootstrapd.conf

Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #13: 185.25.116.107:33445 DA4E4ED4B697F2E9B000EEFE3A34B554ACD3F45F5C96EAEA25...7FF9AF7B43
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #14: 192.99.168.140:33445 6A4D0607A296838434A6A7DDF99F50EF9D60A2C510BBF31FE5...5CB6B4652F
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #15: 46.101.197.175:443 CD133B521159541FB1D326DE9850F5E56A6C724B5B8E5EB5CD8D950408E95707
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #16: 95.215.46.114:33445 5823FB947FF24CF83DDFAC3F3BAA18F96EA2018B16CC08429CB97FA502F40C23
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #17: 5.189.176.217:5190 2B2137E094F743AC8BD44652C55F41DFACC502F125E99E4FE24D40537489E32F
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #18: 198.46.138.44:33445 F404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: List of bootstrap nodes read successfully.
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Public Key: *тут был мой паблик кей*
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Forked successfully: PID: 436.
Dec 23 17:12:53 l64tox1 tox-bootstrapd[436]: Connected to other bootstrap node successfully.
Hint: Some lines were ellipsized, use -l to show in full.


пример лога
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Running "tox-bootstrapd" version 2014101200.
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully read:
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: 'pid_file_path': /var/run/tox-bootstrapd/tox-bootstrapd.pid
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: 'keys_file_path': /var/lib/tox-bootstrapd/keys
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: 'port': 12345
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: 'enable_ipv6': true
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: 'enable_ipv4_fallback': true
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: 'enable_lan_discovery': false
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: 'enable_tcp_relay': true
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Read 2 TCP ports:
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Port #0: 12345
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Port #1: 33445
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: 'enable_motd': true
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: 'motd': blog.saraeff.net
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: General config read successfully
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Set MOTD successfully.
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Keys are managed successfully.
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Initialized Tox TCP server successfully.
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #0: 144.76.60.215:33445 04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #1: 23.226.230.47:33445 A09162D68618E742FFBCA1C2C70385E6679604B2D80EA6E84AD0996A1AC8A074
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #2: 195.154.119.113:33445 E398A69646B8CEACA9F0B84F553726C1C49270558C57DF5F3C368F05A7D71354
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #3: 46.38.239.179:33445 F5A1A38EFB6BD3C2C8AF8B10D85F0F89E931704D349F1D0720C3C4059AF2440A
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #4: 178.62.250.138:33445 788236D34978D1D5BD822F0A5BEBD2C53C64CC31CD3149350EE27D4D9A2F9B6B
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #5: 130.133.110.14:33445 461FA3776EF0FA655F1A05477DF1B3B614F7D6B124F7DB1DD4FE3C08B03B640F
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #6: 104.167.101.29:33445 5918AC3C06955962A75AD7DF4F80A5D7C34F7DB9E1498D2E0495DE35B3FE8A57
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #7: 205.185.116.116:33445 A179B09749AC826FF01F37A9613F6B57118AE014D4196A0E1105A98F93A54702
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #8: 198.98.51.198:33445 1D5A5F2F5D6233058BF0259B09622FB40B482E4FA0931EB8FD3AB8E7BF7DAF6F
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #9: 80.232.246.79:33445 CF6CECA0A14A31717CC8501DA51BE27742B70746956E6676FF423A529F91ED5D
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #10: 108.61.165.198:33445 8E7D0B859922EF569298B4D261A8CCB5FEA14FB91ED412A7603A585A25698832
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #11: 212.71.252.109:33445 C4CEB8C7AC607C6B374E2E782B3C00EA3A63B80D4910B8649CCACDD19F260819
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #12: 194.249.212.109:33445 3CEE1F054081E7A011234883BC4FC39F661A55B73637A5AC293DDF1251D9432B
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #13: 185.25.116.107:33445 DA4E4ED4B697F2E9B000EEFE3A34B554ACD3F45F5C96EAEA2516DD7FF9AF7B43
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #14: 192.99.168.140:33445 6A4D0607A296838434A6A7DDF99F50EF9D60A2C510BBF31FE538A25CB6B4652F
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #15: 46.101.197.175:443 CD133B521159541FB1D326DE9850F5E56A6C724B5B8E5EB5CD8D950408E95707
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #16: 95.215.46.114:33445 5823FB947FF24CF83DDFAC3F3BAA18F96EA2018B16CC08429CB97FA502F40C23
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #17: 5.189.176.217:5190 2B2137E094F743AC8BD44652C55F41DFACC502F125E99E4FE24D40537489E32F
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Successfully added bootstrap node #18: 198.46.138.44:33445 F404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: List of bootstrap nodes read successfully.
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Public Key: *тут был мой паблик кей*
Dec 23 17:12:53 l64tox1 tox-bootstrapd[404]: Forked successfully: PID: 436.
Dec 23 17:12:53 l64tox1 tox-bootstrapd[436]: Connected to other bootstrap node successfully.



Ошибка вида:
error while loading shared libraries: libtoxcore.so.0: cannot open shared object file: No such file or directory

решается вызовом ldconfig

Смотреть лог в режиме реального времени можно вот так: tail -f /var/log/syslog|grep "tox-bootstrapd", но если все работает нормально, то там ничего после запуска, окромя технички, нету.

Теперь о трафике и нагрузке:

toxnode_01

Трафик держится на уровне 230-250 кбит, иногда доходит до 330 кбит. tcpdump выдает только udp пакеты. За сутки работы прилетели и улетело по 2.5Гб трафика, что даст за месяц 75 гигов на выдув. Нагрузка на систему составляет 1%-2%, постоянные 1% я бы сказал (0.4%-1.4%). Сие работает на 8.2 дебиане_64, располагает одним ядром и несет на борту 1Гб оперативки. Если к концу недели все будет без изменений, то вместо 1Гб останется 512Мб.

Будущее анонимного и свободного общения у вас в руках, фактически это свобода слова «as is». Поэтому если каждый вложит свои 5 копеек в виртуалку, то окажет этим огромную пользу сообществу tox.

/nikitasius 4339E5C156D4858940E20F82BE6625BC69B4167EAE1E9924EF79AA474E2A454BE4323FE37C61

upd: 2015-12-23242527 2016-01-13, обновил список node, всего там 202627 30 node (отсюда и автогенератор).
upd: 2015-12-24@10:03, после запуска своей ноды вам надо связаться с image, сообщив страну, ipv4/ipv6, порт, publickey ноды и желаемый никнейм (например, чтобы сохранить анонимность). После этого вашу ноду добавять в вики и в трекер. Это нужно для того, чтобы новые люди могли вас бустить. Хотя ваша нода будет работать и без добавления и писем админу, достаточно указать в конфиге другие ноды.

upd: 2015-12-24@1206, добавлю, что при добавления друга по хешу клиент получает public key добавленного человека и после этого может видеть ip адрес. (Prevent_Tracking.txt, ycombinator). Имейте это в виду, если авторизовываете кого попало.

Еще остается такой вопрос: я прогнал wireshark на чистом аккаунте в группе из 20 человек (groupbot), и видел udp от ip, которые не соответствуют нодам. Получается, находясь в группе, все члены могут «видеть» ip друг-друга. Информация из моих рук, я не проверял, что пишут другие люди. Но если это правда, то нужно проявлять осторожность, получая приглашения вступить куда-либо. Если я не прав — прошу написать об этом в комментах ну, и сноску откуда дровишки.

upd: 2015-12-25@2010, в начало статьи добавлены 3 варианта установки: «сам», «сам с скриптом» и «из пакетов».

upd: 2015-12-25@2305, генератор списка нод для конфига, детали под спойлером.
вот этим
И так: http://tox.0x10k.com/bootstrapd-conf
Как это работает:


Фильтр по странам работает простым дополнением "-de" или "-DE" (регистр не влияет), или "-us". Для двух стран добавляем "-de-us", например как tox.0x10k.com/bootstrapd-conf-ipv46-de-us.txt, который выдаст IPv4 (и, если IPv4 не найдено, то IPv6) для германии (DE) и штатов (US).

Так же есть исключение из конфига ноды по ее ID, что полезно тем, кто хочет обновить свой конфиг, например:
tox.0x10k.com/bootstrapd-conf-ipv46-2.txt — все ноды кроме #2
tox.0x10k.com/bootstrapd-conf-ipv46-fr-3.txt — все ноды из FR кроме ноды #3 (можно сравнить с tox.0x10k.com/bootstrapd-conf-ipv46-fr.txt, где только ноды из FR).
Теги:
Хабы:
+17
Комментарии48

Публикации

Изменить настройки темы

Истории

Работа

Ближайшие события

Weekend Offer в AliExpress
Дата20 – 21 апреля
Время10:00 – 20:00
Место
Онлайн