NextCloud + MegaCMD
Необходимые пакеты на сервере Synology:
- MariaDB 10
- Web Station
- Apache HTTP Server 2.4
- PHP 7.2
Шаг 1. Установить пароль root пользователя для MariaDB 10. Этот пароль очень важно всегда помнить, а еще лучше записать и спрятать под подушкой
Шаг 2. Установка Apache HTTP Server 2.4 с центра пакетов Synology не затруднит
Шаг 3. Установим PHP 7.2 как и предыдущий пакет с центра пакетов
Шаг 4. После установки Web Station его необходимо настроить:
- Включить все Расширения
- Включить кэш PHP
- mysql.default_port=3307 (порт по умолчанию для MariaDB 10)
- opcache.enable=1
- opcache.enable_cli=1
- opcache.interned_strings_buffer=8
- opcache.max_accelerated_files=10000
- opcache.memory_consumption=128
- opcache.save_comments=1
- opcache.revalidate_freq=1
Добавить виртуальный хост в Web Station (Выбрать Apache 2.4 и PHP 7.2)
Скачать и извлечь архив NextCloud
- zip архив взять отсюда nextcloud.com/install
- Извлеченный архив nextcloud.zip скопировать в папку WEB (/volume1/web/) . Пользователю http даете права на чтение/запись файлов на всю директорию Web
Теперь откройте веб-браузер и введите адрес вашей следующей установки IP или домен
Если все хорошо, вы должны найти себя на странице установки Nextcloud. Если ваша страница пуста или вы получаете ошибку, убедитесь, что на вашей веб-станции / виртуальном хосте выбраны apache 2.4 и php 7.2, а не nginx.
Корректно заполнить данные поля следуя подсказкам в поле ввода
Теперь нужно установить пакет MegaCMD
- Добавить в Центр пакетов новый репозиторий Источников пакетов http://packages.synocommunity.com/
- Установить пакет MegaCMD
- Создать скрипт со следующий содержимым
!/bin/bash
mega-cmd
login Ваша_почта от Mega Ваш_пароль
sync Локальная_папка_для_синхронизации /Удаленная_папка_на_Mega
Скачать пример скрипта - Поместить скрипт в удобную папку (закинул в /volume1/web/saniaowner.space/data/)
- Добавить скрипт в планировщик Synology от имени Root с нужной частотой синхронизации (у меня 1 в час)
Скрипт /volume1/web/saniaowner.space/data/mega.sh
В папке Config в файле config.php добавить следующую строку
‘filesystem_check_changes’ => 1,
Эта команда позволяет проверять автоматическое наличие изменений в файлах
Решение возможных проблем
Режим обслуживания
- Чтобы исправить эту проблему нужно запустить команду occ maintenance:mode —off находясь в корневой папке NextCloud.
Для этого подключаемся с помощью Putty к Synology по протоколу SSH - Вводим команду cd /volume1/web/nextcloud и нажимаем Enter. У Вас путь к каталогу может отличаться
- Вводим команду ./occ maintenance:mode —off
Получаем ошибку с текстом: « This version of Nextcloud requires at least PHP 7.2 You are currently runnin g 5.6.11. Please update your PHP version. «
Странно, ведь в Web Station выбран PHP 7.2. - Меняем версию PHP для командной строки.
Входим с правами супер-пользователя командой sudo -i
Переходим в каталог cd /bin
Переименовываем файл mv php php2
Создаем симлинк sudo cp /volume1/@appstore/PHP7.2/usr/local/bin/php72 /bin/php
Переходим в каталог NextCloud и выключаем режим обслуживания cd /volume1/web/nextcloud
Выключаем режим обслуживания sudo -u admin ./occ maintenance:mode —off
Переименовываем обратно файл php cd /bin; mv php2 php - Проверяем исправилась ли проблема
Перенос данных пользователя
- Создаем пользователя, копируем нужные данные в его папку
- Выдаем права на всю папку пользователя rwxrwx— (0770) с разрешением для потомков
- Переходим в директорию NextCloud cd /volume1/web/nextcloud
- Выполняем команду ./occ files:scan user , где user пользователь которого нужно перенести
- Проверяем
CCTV Password Hack PRO — одно приложение, большие возможности
Теперь Вы можете сбросить пароль своего регистратора используя браузер!
Больше подробностей по ссылке
Источник
Настройка сервера Synology: веб-сервер
В сегодняшнем посте я хочу поделиться опытом настройки веб-сервера Synology на ОС DiskStationManager (DSM) v3.2-1955.
Эта инструкция, по моему мнению, подойдёт для любой модели NAS-сервера Synology у которых все отличия только в аппаратной части. Программная часть крутится на DSM, которая регулярно обновляется.
Введение
Начало
Всё началось с того, что после настройки сервера по мануалу, приложенному на CD, не смог поднять виртуальные хосты и, как следствие, добиться нужной мне работоспособности нескольких сайтов на одном сервере.
Установка phpMyAdmin
Если вы планируете «подвязать» ваши сайты на базу данных (БД) рекомендую сразу поставить phpMyAdmin (PMA) для удобства работы с БД (мне БД пока не нужна из-за специфичности необходимой мне задачи):
- Клацаем по кнопке быстрого доступа вверху рабочей области DSM и открываем «Центр пакетов»
В Центре пакетов выбираем вкладку «Доступно» и находим / устанавливаем PMA
После установки PMA переходим во вкладку «Установлено» Центра пакетов и запускаем PMA
Проверим PMA — заходим по своему внешнему IP сервера, либо по локальному 192.168.Х.Х и далее дописываем в адресе /phpMyAdmin/, т.е. как это у меня: 192.168.1.39/phpMyAdmin/ — по умолчанию логин root, пароль оставляем пустым;
Видим такую картину
Запуск и настройка веб-сервера
- Заходим в «Панель управления» → «Веб-службы»
Активируем чекбоксы «Включить Web Station» и «Включить MySQL»
Клик на кнопке «Виртуальный хост» и создаём виртуальные хосты под свои сайты
- «Имя подпапки» — имя подпапки в папке «web», в которой будет лежать ваш сайт;
- «Имя хоста»- имя хоста по которому будет происходить обращение к вашему сайту:
- В моём случае я у своего хостинг-провайдера создал поддомен download.abandongames.ru;
- Для него в настройках/управлении DNS отредактировал А-запись прописав СТАТИЧЕСКИЙ внешний IP своего сервера;
- Через какое-то время (до нескольких часов) происходит обновление DNS записей и с вашего домена/поддомена будут идти запросы на ваш сервер;
- Линк для наглядности
Если у вас нет СТАТИЧЕСКОГО IP, а есть динамический, который вам каждый раз при подключении к Интернет выдаёт интернет-провайдер, то вам поможет «Панель управления» → «DDNS»
— регистрируетесь, указываете имя хоста для DDNS и вписываете это имя в поле виртуальных хостов;
Запуск сайта
- Заходим на сервер, например, по локальному IP через:
- Проводник Windows;
- Файловый менеджер;
- Средствами DSM (проводник)
- Видим примерно такую файловую структуру
— для нас важна папка «web»;
Заходим в папку «web» и видим ту самую подпапку (в моём случае abandongames), которую мы прописали в виртуальных хостах в поле «Имя подпапки»
Доступ по FTP
Тонкости, на которые стоит обратить внимание
- Самое главное — не нужно создавать подпапки «www» в папках с сайтами в которых будет наш index.php, как это написано в мануале к серверу! Т.е. в /web/abandongames/www/ — папка «www» не нужна!
- Общая папка «web» также может содержать index.htm, index.html или index.php, в данном случае подпапка «www» так же не требуется;
- Для генерации своих страниц ошибок необходимо положить в корень общей папки «web» файлы missing.html, missing.htm или missing.php. Вероятней всего, что для подпапок с сайтами так же применимо это правило, т.е. /web/abandongames/missing.php;
- Запрещено создавать в общей папке «web» подпапки «blog», «photo», «photosrc», «webdefault»;
Некоторые рекомендации
- Закройте 5000 порт, если не управляете сервером удалённо, а если управляете, то пропишите в настройках роутера только разрешённые IP с которых вы планируете входить в DSM;
- При установки PMA необходимо изменить пароль доступа для root и при необходимости создать новых пользователей БД (в PMA) со своими правами;
- При манипуляциями файлами сайтов работать нужно в бинарном режиме (FTP);
- Если что-то на сайте не работает (какой-то функционал не зависящий от кривых рук), первоначально нужно проверить права доступа на файл/папку сайта в FTP режиме и выставить соответствующие права;
- Пробросить на роутере необходимые порты
В данном случае у меня для FTP 20 порт проброшен на один сервер, 21 порт на другой, поэтому не удивляйтесь.
Надеюсь своим постом я облегчу поднятие домашнего веб-сервера Synology.
Источник
Megacmd как настроить synology
MEGAcmd — Command Line Interactive and Scriptable Application
MEGAcmd provides non UI access to MEGA services. It intends to offer all the functionality with your MEGA account via commands. It features synchronization , backup of local folders into your MEGA account and a webdav/streaming server.
Available packages for MEGAcmd in all supported platforms should be found here. If the package fails to install, read below for the requirements.
It supports 2 modes of interaction:
- Interactive — A shell to query your actions
- Scriptable — A way to execute commands from a shell/a script/another program
In order to provide those 2 modes, it features one server (MEGAcmdServer), an interactive shell (MEGAcmdShell) and several commands that will launch the non-interactive client (MEGAcmdClient).
See Usage and Platform to understand how to use it in your particular system.
If you wish to build or install MEGAcmd, here are a list of requirements and instructions.
The requirements are the same as those for the sdk (usually cryptopp, zlib, sqlite3, cares, libuv, ssl, curl, sodium, readline for platforms other than Windows. It is recommended to include pcre to have support for regular expressions.
In order to have support for thumbnails and previews, it is highly recommended to have ffmpeg ( libavcodec-dev libavutil-dev libavformat-dev libswscale-dev ) and mediainfo ( libmediainfo-dev + libzen-dev ) for media file attributes.
For convenience, here is a list of packages for common Linux Distros and precompiled third party dependencies for other Operative Systems:
Ubuntu 16.04
- autoconf libtool g++ libcrypto++-dev libz-dev libsqlite3-dev libssl-dev libcurl4-openssl-dev libreadline-dev libpcre++-dev libsodium-dev libc-ares-dev libfreeimage-dev libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libmediainfo-dev libzen-dev
Ubuntu 18.04
- autoconf libtool g++ libcrypto++-dev libz-dev libsqlite3-dev libssl-dev libcurl4-gnutls-dev libreadline-dev libpcre++-dev libsodium-dev libc-ares-dev libfreeimage-dev libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libmediainfo-dev libzen-dev libuv1-dev
Debian 9
- libcrypto++ libpcrecpp0v5 libc-ares-dev zlib1g-dev libuv1 libssl-dev libsodium-dev readline-common sqlite3 curl autoconf libtool g++ libcrypto++-dev libz-dev libsqlite3-dev libssl-dev libcurl4-gnutls-dev libreadline-dev libpcre++-dev libsodium-dev libc-ares-dev libfreeimage-dev libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libmediainfo-dev libzen-dev
- In some instanances you may need to run apt install —reinstall build-essential
Windows
MacOS
- For MacOS, here is a bundle with all the 3rd party dependencies required to build, plus a config.h file to be placed at sdk/include/mega/config.h : https://mega.nz/#F!WwZyBZRL!1vXiBr7pJZLINpSRErBxvA
Getting the source
Ensure you obtain the repository recursively.
Building and installing
For platforms with Autotools, MEGAcmd can be built and installed with:
- You will need to run make install as root
Note : if you use a prefix in configure, autocompletion from non-interactive usage won’t work. You would need to source /YOUR/PREFIX/etc/bash_completion.d/megacmd_completion.sh (or link it at /etc/bash_completion.d)
Alternatively you can build using Qt project located at contrib/QtCreator/MEGAcmd/MEGAcmd.pro .
For Windows/MacOS you will need to place the 3rdparty folder (included in the dependency bundle referenced above ) into sdk/bindings/qt/ .
Before explaining the two ways of interaction, it is important to understand how MEGAcmd works. When you login with MEGAcmd, your session, the list of synced folders, and some cache database are stored in your local home folder. MEGAcmd also stores some other configuration in that folder. Closing it does not delete those and restarting your computer will restore your previous session (the same as megasync won’t ask for user/password once you restart your computer).
You will need to logout properly in order to clean your data.
Now let’s get into details of the two usage modes. Both modes require that MEGAcmdServer is running. You can manually launch it. Fortunately, you can also open the interactive shell or execute any command and the server will start automatically.
Execute MEGAcmd shell. Platform section explains how to do that in the different supported systems. You should be facing an interactive shell where you can start typing your commands, with their arguments and flags.
You can list all the available commands with help .
And obtain useful information about a command with command —help
First you would like to log in into your account. Again, notice that doing this stores the session and other stuff in your home folder. A complete logout is required if you want to end you session permanently and clean any traces (see logout —help for further info).
When MEGAcmd server is running, it will be listening for client commands. Use the different mega-* commands available.
mega-help will list all these commands (you will need to prepend «mega-» to the commands listed there). To obtain further info use mega-command —help .
Those commands will have an output value != 0 in case of failure. See megacmd.h to view the existing error codes.
Ideally, you would like to have these commands in your PATH variable (See Platform for more info). For further info use mega-help —non-interactive .
Here are some examples of use (more info and usage examples are available at the User Guide).
Notice: the commands listed here assume you are using the interactive interaction mode: they are supposed to be executed within MEGAcmdShell.
- A synchronization can be established simply by typing:
This will synchronize the contents in your local and your mega folder both ways.
- You can also set remote backups of a local folder to keep historical snapshots of your files. So simple as:
This will configure a backup of «myfolder» into /remote/path that will be carried out at 4:00 A.M. (UTC) every day. It will store the last 10 copies.
Further info on backups here.
- You serve a location in your MEGA account via WebDAV:
- Or stream a file in your MEGA account:
Further info on webdav and streaming here.
- Download the contents of a shared link:
Now let’s do something more complicated with non-interactive usage using some GNU tools (similar stuff can be easily done in Windows as well):
- We want to provide something crypto secured with only 10 minutes of access:
- Or imagine we’d like to public the enterprise promotional videos of May 2015 that we have previously stored in MEGA:
If you have installed MEGAcmd using one of the available packages at here.
Or have it built without —prefix , both the server ( mega-cmd-server ), the shell ( mega-cmd ) and the different client commands ( mega-* ) will be in your PATH (on a fresh install, you might need to open your terminal again).
If you are using bash, you should also have autocompletion for client commands working.
If that is not you case, include the location for the binaries in your PATH variable.
You can have MEGAcmd installed using the installer from here.
If you are interested in installing MEGAcmd without human intervention, notice that this installer supports silent installation, you just need to execute in your command prompt:
Once you have MEGAcmd installed, you just need to execute it (via Desktop icon or Start Menu) to open the shell. This will open MEGAcmdServer in the background (a process named MEGAcmdServer.exe).
For a better user experience (specially in Windows 7) we recommend executing MEGAcmd from PowerShell.
Open PowerShell and execute:
For non-interactive usage, there are several mega-*.bat client commands you can use writting their absolute paths, or including their location into your environment PATH and execute them normally ( mega-* ).
If you use PowerShell and you have installed the official MEGAcmd, you can do that simply with:
Client commands completion requires bash, hence, it is not available for Windows.
Although there have been several efforts in having non-ASCII unicode characters supported in Windows, there still may be some issues. Pay special attention if you are willing to use pipes or send the output of a command into a file from your client commands. See help —unicode for further info regarding that.
Install MEGAcmd from here.
For MacOS, after installing the dmg, you can launch the server using MEGAcmd in Applications. If you wish to use the client commands from MacOS Terminal, open the Terminal and include the installation folder in the PATH .
Typically:
And for bash completion, source megacmd_completion.sh :
Currently we have build scripts for Synology and QNAP, which can be found in the build/ folder along with instructions on how to set up the build. Typically this results in a ‘package’ which can then be manually installed in the NAS. To use MEGAcmd on those systems, ssh into the device and run the commands as normal (having first added their folder to your PATH variable).
*Important note for MacOS Catalina or above: since Catalina, MacOS uses zsh as default shell. If you want to have auto completion, we strongly recommend you to use bash shell (just execute bash in your terminal).
MEGAcmd features autocompletion in both interactive and non-interactive (only for bash) mode. It will help completing both local and remote (Mega Cloud) files, flags for commands, values for flags/access levels, even contacts.
There are two different kinds of logging messages:
- SDK based: those messages reported by the sdk and dependent libraries.
- MEGAcmd based: those messages reported by MEGAcmd itself.
You can adjust the level of logging for those kinds with log command.
However, passing -v ( -vv , -vvv , and so on for a more verbose output) to an specific command will use higher level of verbosity of MEGAcmd based messages.
Further info on verbosity here.
If you have compiled MEGAcmd with PCRE (enabled by default), you can use PCRE compatible expressions in certain commands with the flag —use-pcre . Otherwise, if compiled with c++11, c++11 regular expressions will be used.
If none of the above is the case, you can only use wildcards: «*» for any number of characters or «?» for a single unknown character.
You can check the regular expressions compatibility with find —help :
Notice: if you use MEGAcmd in non interactive mode, notice that shell pattern will take precedence. You will need to either escape symbols like * ( \* ) or surround them between quotes (e.g: «*.txt»).
MEGAcmd updates automatically for Windows & MacOS.
For Linux, whenever there is a new update, it will be published in the corresponding repository and your system’s updating tool will let you update it.
Disable automatic updates
You can type update —auto=OFF to disable automatic updates. update —auto=ON will re-enable them.
If you want to see the state of automatic updates you can use update —auto=query . This will inform if automatic updates are enabled or not.
Notice that MEGAcmdServer must be running in order to have automatic updates working.
You can also update manually by typing update within MEGAcmd. This will check if there are updates available and proceed to update if affirmative. Whenever MEGAcmd is updated it will be restarted (all open instances of MEGAcmdShell will be restarted too).
Alternatively you can also execute MEGAcmdUpdater.exe in Windows or MEGAcmdUpdater (located at /Applications/MEGAcmd.app/Contents/MacOS) in MacOS.
Currently there are certain discrepancies with PATHS when logging into a public folder.
For instance, imagine a folder named toshare with a subfolder named x . If we login in to toshare and execute find /x , this will be the output:
Whereas if we execute find /toshare/x , we receive an error, since folder absolute path refers to / as root path.
It might better be referred as /toshare/x .
About
Command Line Interactive and Scriptable Application to access MEGA
Источник