- Сетевая установка Linux
- Установка через PXE
- Установка Linux через iPXE
- Установка Ubuntu по сети
- Содержание
- Настройка сервера для установки
- Настройка сервера сетевой загрузки
- TFTP сервер
- Веб-сервер Apache
- DHCP сервер
- Установка по при помощи Minimal CD
- Install
- Quickstart
- Script installation
- Linux installation from precompiled binary
- macOS installation with brew
- macOS installation from precompiled binary, using curl
- macOS installation from precompiled binary, using a web browser
- Install with docker
- Install from source
- Installation with Ansible
- Autostart
- Autostart on Windows
- Running in background
- User account
- Start from Startup folder
- Start from Task Scheduler
- Run as service
- Mount command built-in service integration
- Third party service integration
- Autostart on Linux
- Start as a service
- Run periodically from cron
Сетевая установка Linux
Недавно столкнулся с установкой Centos 7 в необычных условиях.
Во-первых, дома. То есть имел дело с локальными компьютером, а не с сервером с IPMI.
Во-вторых, за неимением дискового привода обычно использую загрузочную флешку, которая в данном случае оказалась бесполезной, так как новый компьютер загружается только с флешек с инсталятором Windows. Проблема не новая, судя по отзывам о материнской плате.
В моем распоряжении осталась сеть. Приведу пример установки Centos 7 по PXE и iPXE
Итак, начнем.
Как установить Linux через ipxe?
Как установить Linux через pxe?
Установка через PXE
Соединим ethernet кабелем компьютер1 — на котором будут DHCP, TFTP и компьютер2 — на который должна быть установлена ОС.
Добавим статичные настройки сетевого адаптера на компьютер1. Мой адрес 192.168.1.50.
Скачаем и установим TFTP. В этой программе настроим DHCP и TFTP сервер с которого отдадим IP адрес и установочные файлы компьютеру2.
Отключим брандмауэр и запустим tftpd с правами администратора. Выставим аналогичные установки, как на картинках. Возможно потребуется перезапуск tftpd.
На компьютере2 в boot меню выберем сетевой адаптер. В окне tftpd на компьютере1 будет отображаться шкала прогресса.
После этого, на компьютере2 загрузится окно инсталлятора ОС.
Установка Linux через iPXE
Скачаем образ ipxe.iso. Rufus-ом создадим загрузочную флешку на основе этого образа.
Выложим скрипт install.ipxe на любой веб сервер. О том, как поднять веб сервер на локальном компьютере можно узнать тут. Адрес моего скрипта будет таким sitename.ru/install.ipxe
Содержимое скрипта install.ipxe для установки Centos 7
По аналогии с этим скриптом для установки Centos 7, можете подготовить свой скрипт для установки другой ОС.
Соединим компьютер, на который необходимо установить Linux, и роутер ethernet кабелем. Вставим флешку и загрузимся с нее. После нажатия F12 появится ipxe консоль. Используем следующие команды для получения IP адреса и скачивания скрипта
После этого загрузится окно инсталлятора ОС.
Источник
Установка Ubuntu по сети
Содержание
Ubuntu, как и многие другие дистрибутивы Linux, можно легко установить по сети. Для этого вам всего лишь потребуется сетевое соединение с компьютером, который будет служить сервером для установки. BIOS вашего компьютера должен для этого поддерживать загрузку по сети.
Настройка сервера для установки
Прежде всего вам потребуется компьютер с Ubuntu или с другим дистрибутивом Linux (данная инструкция написана для Ubuntu), с которого вы будете устанавливать систему (сервер загрузки по сети), и ISO образ Alternate диска с необходимой версией Ubuntu.
Настройка сервера сетевой загрузки
Для установки всего необходимого лучше использовать aptitude, которая не входит в стандартную поставку Ubuntu начиная с версии 10.10. Поэтому сначала ставим aptitude через любую программу установки пакетов или командой
Далее ставим всё необходимое:
Ключ -R нужен для того, чтобы atftpd поставился без inetd сервера, который вам совершенно не нужен.
Теперь пора настроить все компоненты.
TFTP сервер
Откройте файл /etc/default/atftpd в любом текстовом редакторе с правами суперпользователя, например, так:
Измените первую строчку с
Кроме этого запомните каталог, который находится в конце строчки OPTIONS . Скорее всего это будет /srv/tftp , но в старых Ubuntu может быть и /var/lib/tftpboot . Редактируем файл /etc/default/tftpd-hpa:
вписываем, запомненный каталог
Теперь просто запустите atftpd :
Теперь создайте в каталоге из OPTIONS папку ubuntu. Далее везде будем считать, что используется каталог /srv/tftp :
На этом настройка TFTP закончена.
Веб-сервер Apache
Что-либо менять в настройках Apache не требуется, достаточно сделать созданный в предыдущем разделе каталог ubuntu доступным через HTTP . Для этого создайте на него симлинк из рабочей папки Apache:
DHCP сервер
В этом файле необходимо изменить следующие настройки:
Теперь необходимо перевести второй компьютер в режим загрузки по сети. После этого Вы должны увидеть экран установки Ubuntu.
Установка по при помощи Minimal CD
Если вы по каким-то причинам не можете использовать полноценный диск с Ubuntu, но всё же в вашем компьютере есть CD привод и подключение к интернету, то вы можете поставить систему по сети, загрузившись с маленького диска Minimal CD.
В этом случае система поставится целиком из интернет-репозитория, а диск нужен будет только для запуска процесса установки.
Источник
Install
Rclone is a Go program and comes as a single binary file.
Quickstart
- Download the relevant binary.
- Extract the rclone or rclone.exe binary from the archive
- Run rclone config to setup. See rclone config docs for more details.
- Optionally configure automatic execution.
See below for some expanded Linux / macOS instructions.
See the Usage section of the docs for how to use rclone, or run rclone -h .
Already installed rclone can be easily updated to the latest version using the rclone selfupdate command.
Script installation
To install rclone on Linux/macOS/BSD systems, run:
For beta installation, run:
Note that this script checks the version of rclone installed first and won’t re-download if not needed.
Linux installation from precompiled binary
Fetch and unpack
Copy binary file
Run rclone config to setup. See rclone config docs for more details.
macOS installation with brew
macOS installation from precompiled binary, using curl
To avoid problems with macOS gatekeeper enforcing the binary to be signed and notarized it is enough to download with curl .
Download the latest version of rclone.
Unzip the download and cd to the extracted folder.
Move rclone to your $PATH. You will be prompted for your password.
(the mkdir command is safe to run, even if the directory already exists).
Remove the leftover files.
Run rclone config to setup. See rclone config docs for more details.
macOS installation from precompiled binary, using a web browser
When downloading a binary with a web browser, the browser will set the macOS gatekeeper quarantine attribute. Starting from Catalina, when attempting to run rclone , a pop-up will appear saying:
The simplest fix is to run
Install with docker
The rclone maintains a docker image for rclone. These images are autobuilt by docker hub from the rclone source based on a minimal Alpine linux image.
The :latest tag will always point to the latest stable release. You can use the :beta tag to get the latest build from master. You can also use version tags, e.g. :1.49.1 , :1.49 or :1 .
There are a few command line options to consider when starting an rclone Docker container from the rclone image.
You need to mount the host rclone config dir at /config/rclone into the Docker container. Due to the fact that rclone updates tokens inside its config file, and that the update process involves a file rename, you need to mount the whole host rclone config dir, not just the single host rclone config file.
You need to mount a host data dir at /data into the Docker container.
By default, the rclone binary inside a Docker container runs with UID=0 (root). As a result, all files created in a run will have UID=0. If your config and data files reside on the host with a non-root UID:GID, you need to pass these on the container start command line.
If you want to access the RC interface (either via the API or the Web UI), it is required to set the —rc-addr to :5572 in order to connect to it from outside the container. An explanation about why this is necessary is present here.
- NOTE: Users running this container with the docker network set to host should probably set it to listen to localhost only, with 127.0.0.1:5572 as the value for —rc-addr
It is possible to use rclone mount inside a userspace Docker container, and expose the resulting fuse mount to the host. The exact docker run options to do that might vary slightly between hosts. See, e.g. the discussion in this thread.
You also need to mount the host /etc/passwd and /etc/group for fuse to work inside the container.
Here are some commands tested on an Ubuntu 18.04.3 host:
Install from source
Make sure you have at least Go go1.13 installed. Download go if necessary. The latest release is recommended. Then
This will leave you a checked out version of rclone you can modify and send pull requests with. If you use make instead of go build then the rclone build will have the correct version information in it.
You can also build the latest stable rclone with:
or the latest version (equivalent to the beta) with
These will build the binary in $(go env GOPATH)/bin (
/go/bin/rclone by default) after downloading the source to the go module cache. Note — do not use the -u flag here. This causes go to try to update the dependencies that rclone uses and sometimes these don’t work with the current version of rclone.
Installation with Ansible
- git clone https://github.com/stefangweichinger/ansible-rclone.git into your local roles-directory
- add the role to the hosts you want rclone installed to:
Autostart
After installing and configuring rclone, as described above, you are ready to use rclone as an interactive command line utility. If your goal is to perform periodic operations, such as a regular sync, you will probably want to configure your rclone command in your operating system’s scheduler. If you need to expose service-like features, such as remote control, GUI, serve or mount, you will often want an rclone command always running in the background, and configuring it to run in a service infrastructure may be a better option. Below are some alternatives on how to achieve this on different operating systems.
NOTE: Before setting up autorun it is highly recommended that you have tested your command manually from a Command Prompt first.
Autostart on Windows
The most relevant alternatives for autostart on Windows are:
- Run at user log on using the Startup folder
- Run at user log on, at system startup or at schedule using Task Scheduler
- Run at system startup using Windows service
Running in background
Rclone is a console application, so if not starting from an existing Command Prompt, e.g. when starting rclone.exe from a shortcut, it will open a Command Prompt window. When configuring rclone to run from task scheduler and windows service you are able to set it to run hidden in background. From rclone version 1.54 you can also make it run hidden from anywhere by adding option —no-console (it may still flash briefly when the program starts). Since rclone normally writes information and any error messages to the console, you must redirect this to a file to be able to see it. Rclone has a built-in option —log-file for that.
Example command to run a sync in background:
User account
As mentioned in the mount documentation, mounted drives created as Administrator are not visible to other accounts, not even the account that was elevated as Administrator. By running the mount command as the built-in SYSTEM user account, it will create drives accessible for everyone on the system. Both scheduled task and Windows service can be used to achieve this.
NOTE: Remember that when rclone runs as the SYSTEM user, the user profile that it sees will not be yours. This means that if you normally run rclone with configuration file in the default location, to be able to use the same configuration when running as the system user you must explicitely tell rclone where to find it with the —config option, or else it will look in the system users profile path ( C:\Windows\System32\config\systemprofile ). To test your command manually from a Command Prompt, you can run it with the PsExec utility from Microsoft’s Sysinternals suite, which takes option -s to execute commands as the SYSTEM user.
Start from Startup folder
To quickly execute an rclone command you can simply create a standard Windows Explorer shortcut for the complete rclone command you want to run. If you store this shortcut in the special «Startup» start-menu folder, Windows will automatically run it at login. To open this folder in Windows Explorer, enter path %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup , or C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp if you want the command to start for every user that logs in.
This is the easiest approach to autostarting of rclone, but it offers no functionality to set it to run as different user, or to set conditions or actions on certain events. Setting up a scheduled task as described below will often give you better results.
Start from Task Scheduler
Task Scheduler is an administrative tool built into Windows, and it can be used to configure rclone to be started automatically in a highly configurable way, e.g. periodically on a schedule, on user log on, or at system startup. It can run be configured to run as the current user, or for a mount command that needs to be available to all users it can run as the SYSTEM user. For technical information, see https://docs.microsoft.com/windows/win32/taskschd/task-scheduler-start-page.
Run as service
For running rclone at system startup, you can create a Windows service that executes your rclone command, as an alternative to scheduled task configured to run at startup.
Mount command built-in service integration
For mount commands, Rclone has a built-in Windows service integration via the third party WinFsp library it uses. Registering as a regular Windows service easy, as you just have to execute the built-in PowerShell command New-Service (requires administrative privileges).
Example of a PowerShell command that creates a Windows service for mounting some remote:/files as drive letter X: , for all users (service will be running as the local system account):
The WinFsp service infrastructure supports incorporating services for file system implementations, such as rclone, into its own launcher service, as kind of «child services». This has the additional advantage that it also implements a network provider that integrates into Windows standard methods for managing network drives. This is currently not officially supported by Rclone, but with WinFsp version 2019.3 B2 / v1.5B2 or later it should be possible through path rewriting as described here.
Third party service integration
To Windows service running any rclone command, the excellent third party utility NSSM, the «Non-Sucking Service Manager», can be used. It includes some advanced features such as adjusting process periority, defining process environment variables, redirect to file anything written to stdout, and customized response to different exit codes, with a GUI to configure everything from (although it can also be used from command line ).
There are also several other alternatives. To mention one more, WinSW, «Windows Service Wrapper», is worth checking out. It requires .NET Framework, but it is preinstalled on newer versions of Windows, and it also provides alternative standalone distributions which includes necessary runtime (.NET 5). WinSW is a command-line only utility, where you have to manually create an XML file with service configuration. This may be a drawback for some, but it can also be an advantage as it is easy to back up and re-use the configuration settings, without having go through manual steps in a GUI. One thing to note is that by default it does not restart the service on error, one have to explicit enable this in the configuration file (via the «onfailure» parameter).
Autostart on Linux
Start as a service
To always run rclone in background, relevant for mount commands etc, you can use systemd to set up rclone as a system or user service. Running as a system service ensures that it is run at startup even if the user it is running as has no active session. Running rclone as a user service ensures that it only starts after the configured user has logged into the system.
Run periodically from cron
To run a periodic command, such as a copy/sync, you can set up a cron job.
Источник