Synology DSM Customization: Unlocking the Potential of NAS
Synology DSM Customization: Unlocking the Potential of NASdsm-custom.jpgimage from unsplashAboutAs you know, Synology NAS devices are based on the Linux kernel, but they have some function limitations that make installing applications not as easy as using package management systems like apt, yum, or dnf. Also, commands like usermod and groupadd don't actually exist on Synology NAS.Sudo without Password (Option)Eable SSH on Synology2023-06-21_090947.pngRemove the need to enter a password each time sudo is used.Log in to Synology DSM using ssh with an account that has sudo permissions.$(whoami) is the current username, which is up to you.Update the permission to read-only.current_user=$(whoami) echo "$current_user ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/"$current_user" sudo chmod 440 /etc/sudoers.d/"$current_user"Install Entware on Synology DSMEntware has been adapted for Synology's DSM as a software repository.Create a folder on your HDDmkdir -p /volume1/@Entware/optRemove /opt and mount the Optware folder.Make sure that the /opt folder is empty (Optware is not installed). Remove the /opt folder with its contents in this step.rm -rf /opt mkdir /opt mount -o bind "/volume1/@Entware/opt" /optNote: If the bind command doesn't work, try creating a link instead:ln -s /volume1/@Entware/opt/ /optRun the installation script depending on the processor (uname -m to know).for armv8 (aarch64) - Realtek RTD129xwget -O - https://bin.entware.net/aarch64-k3.10/installer/generic.sh | /bin/shfor armv5wget -O - https://bin.entware.net/armv5sf-k3.2/installer/generic.sh | /bin/sh wget -O - https://bin.entware.net/armv7sf-k3.2/installer/generic.sh | /bin/shfor x64for armv7wget -O - https://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/shCreate Autostart TaskCreate a triggered user-defined task in Task Scheduler.Goto: DSM > Control Panel > Task SchedulerCreate > Triggered Task > User Defined ScriptGeneralTask: EntwareUser: rootEvent: Boot-upPretask: noneTask SettingsRun Command: (as bellow)#!/bin/sh # Mount/Start Entware mkdir -p /opt mount -o bind "/volume1/@Entware/opt" /opt /opt/etc/init.d/rc.unslung start # Add Entware Profile in Global Profile if grep -qF '/opt/etc/profile' /etc/profile; then echo "Confirmed: Entware Profile in Global Profile" else echo "Adding: Entware Profile in Global Profile" cat >> /etc/profile <<"EOF" # Load Entware Profile [ -r "/opt/etc/profile" ] && . /opt/etc/profile EOF fi # Update Entware List /opt/bin/opkg updateReboot your NAS.Install PackagesInstall all the packages through opkgsudo opkg install git git-http wget curl tree iperf3This installs Git, Git over HTTP, wget, curl, tree, and iperf3 packages using the opkg package manager with superuser privileges.Manage Docker Without Using SudoManage Docker on Synology NAS via ssh without requiring sudo.Create a new user group called docker.sudo synogroup --add dockerAdd the user you want to use to this groupsudo synogroup --member docker $USERChange the ownership of the docker.sock file.sudo chown root:docker /var/run/docker.sockOnce have completed these steps, log out and back in again to ensure the changes take effect.Install VIM-PLUG on Synology DSMDownload plug.vim and put it in the "autoload" directory.curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vimAdd a vim-plug section to your ~/.vimrc.cat >> ~/.vimrc << EOF call plug#begin() Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'tpope/vim-commentary' Plug 'scrooloose/nerdtree' Plug 'joshdick/onedark.vim' call plug#end() """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Keyboard mapping to toggle the nerdtree file explorer. nnoremap <F5> :exec 'NERDTreeToggle' <CR> " => Colors and Fonts """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Enable syntax highlighting syntax enable " Set colorscheme set background=dark " Set utf8 as standard encoding and en_US as the standard language set encoding=utf8 " Use Unix as the standard file type set ffs=unix,dos,mac " Enable status bar color set t_Co=256 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Vim Airline themes let g:airline_powerline_fonts=1 let g:airline#extensions#tabline#enabled=1 " Vim Cpp Highlight let g:cpp_class_scope_highlight=1 let g:cpp_member_variable_highlight=1 let g:cpp_experimental_simple_template_highlight=1 let g:cpp_concepts_highlight=1 EOFReload .vimrc and install plugins.Open vi editor:PlugInstall CommandsCommandDescriptionPlugInstall [name ...] [#threads]Install pluginsPlugUpdate [name ...] [#threads]Install or update pluginsPlugClean[!]Remove unlisted plugins (bang version will clean without prompt)PlugUpgradeUpgrade vim-plug itselfPlugStatusCheck the status of pluginsPlugDiffExamine changes from the previous update and the pending changesPlugSnapshot[!] [output path]Generate script for restoring the current snapshot of the pluginsConclusionEntware, managing Docker without requiring sudo, and installing packages using opkg. This is a useful for users looking to customize on Synology NAS devices.ReferenceInstall on Synology NASManage docker without needing sudo on your Synology NASVIM-PLUG
入坑IMTNAS星際魔盒2 - 部署 Entware 倉庫軟件到IMTNAS星際魔盒
部署 Entware 倉庫軟件到IMTNAS星際魔盒IMTNAS-074242.jpg前言:​ 星際魔盒(MCS7)的內核是Linux3.10！Debian Wheezy系統(官方早已停止支援)算得上是中古時代的產物了, 嘗試換源, 還是各種報錯, 不得不放棄. 最後想到Entware倉庫軟件.什麼是Entware:Entware 是一個嵌入式 Linux 設備的軟件倉庫集成工具，也就是傳統 Linux 上的包管理工具，例如 Debian 的 dpkg、CentOS 的 yum 等。 它們可以通過網絡在遠程倉庫上拉取並安裝所需要的包，同時自動解決依賴問題，是系統上不可或缺的一部分。Entware部署:01.PNGSSH登入用戶名: admin密碼: adminsudo -i mv /opt/ ./opt.bak刪除或備份原/opt資料夾mkdir -p /mnt/hdd1/opt ln -sf /mnt/hdd1/opt/ /opt建立一個空白的/opt資料夾 (用於安裝entware套件) 並建立符號連結02.pngwget -O - http://pkg.entware.net/binaries/armv7/installer/entware_install.sh | /bin/sh據處理器執行安裝(星際魔盒是armv7)加入到開機自啟動文件/etc/rc.localsed -i -e '/# By default this script does nothing./a\ln -sf /mnt/hdd1/opt/ /opt\ opt/etc/init.d/rc.unslung start' /etc/rc.local添加到 PATH 的環境變量。即/opt/bin /opt/sbin03.pngecho '. /opt/etc/profile' >> /etc/profile更新環境變量source /etc/profile04.png查看更新環境變量reboot重新啟動 NAS2020-10-21_120258.pngopkg updateDownloading http://pkg.entware.net/binaries/armv7/Packages.gz.Updated list of available packages in /opt/var/opkg-lists/packages.舉個例子例子1:利用opkg安裝網路速度測試工具 iPerf306.png07.png08.png例子2:通過opkg安裝 shellinabox可以不需要安裝類似於xShell或Putty的通訊工具(瀏覽器模擬一個遠程系統的Shell )09.png10.png查看是否成功執行shellinabox11.png默认端口为4200結語: ​ 我們可以愉快地使用 opkg 包管理系統，在官方的源上已經有超過2000個軟件包，非常的豐富.參考網站: Install entware repository on Synology NAShttps://entware.net/