This project contains an approach to maintain several systems with aminimum of fuss. To accomplish this, there are scripts to installsystem packages (if required), set up a home directory for a user, andinstall user-specific packages. Configurations for many programs areinstalled by default and some programs are handled specially.
This supports all UNIX and Windows platforms. Other platforms may ormay not work depending on their approach to user configuration andsupport for Python.
The home directory is intended to be tracked using git and sharedpublicly. It is intended to be used unchanged across multiplemachines and so should be designed to work well across different typesof systems that support Python and the various programs. Sensitiveinformation is provided for by including hooks to local files that areare not included in the shared repository.
Keeping the configuration of several systems consistent ischallenging. There are some high-level tools for doing so, but arecomplicated to set up. This intends to be a fairly straightforwardapproach to the problem.
Bootstrapping a system involves making sure theadministrator
useris present and satisfies the minimal requirements for an administratorof the system. It also ensures that required system packages areinstalled.
Installing system packages involves ensuring that the system is up todate and all required packages are installed.
~/opt/local
cmd
While theinstall
portion of this system supports Cygwin- orMSYS-based systems, the package managers for those systems are notsupported.
The install family of scripts assumes that they are run from the rootof thetee3/homedir
directory.
administrator
useryum
- orapt-get
-based Linux systemroot
accesssudo
)administrator
useryum
- orapt-get
-based Linux systemsudo
sudo
)python
stow
(except on Windows)For installing user services, the following programs are required.
launchctl
for macOSsystemctl
for LinuxTo configure some useful programs, those programs must exist on thesystem.
bash
zsh
git
mercurial
emacs
python
ruby
rust
node.js
go
The process below assumes a system with a user namedadministrator
that may or may not yet havesudo
privileges.
This is especially useful with a “minimal installation” Linux machinesince many packages are not installed by default.
From the login terminal of the system, log in asroot
and theninstallsudo
and giveadministrator
sudo
privileges.
login: rootpassword:************
yuminstall sudousermod administrator-a-G wheelexit
From the login terminal of the system, log in asadministrator
andthen installgit
, clone thetee3/homedir
repository and installthe system packages. At the end of this process, the machine willreboot, so make sure there is no one else logged in.
login: administratorpassword:************
sudoyuminstallgitgit clone https://github.com/tee3/homedir.git ~/Development/homedircd ~/Development/homedir./install_bootstrap_packages_fedorasudoshutdown-r now
From the login terminal of the system, log in asroot
and theninstallsudo
and giveadministrator
sudo
privileges.
login: rootpassword:************
apt-getinstall sudoadduser administratorsudoexit
From the login terminal of the system, log in asadministrator
andthen installgit
, clone thetee3/homedir
repository and installthe system packages. At the end of this process, the machine willreboot, so make sure there is no one else logged in.
login: administratorpassword:************
sudoapt-getinstallgitgit clone https://github.com/tee3/homedir.git ~/Development/homedircd ~/Development/homedir./install_bootstrap_packages_debiansudoshutdown-r now
Install Xcode and the Xcode Command-Line Tools, as well as Homebrew,while logged in to the graphical system asadministrator
. From aTerminal.app window install the system packages. At the end of thisprocess, the machine will reboot, so make sure there is no one elselogged in.
git clone https://github.com/tee3/homedir.git ~/Development/homedircd ~/Development/homedir./install_bootstrap_packages_macossudoshutdown-r now
Go to Settings->Update & Security->For developers->Developer Mode andenable it. Install “App Installer” from the Microsoft Store, and theWindows Package Manager CLI (winget-cli
) fromhttps://github.com/microsoft/winget-cli.
Boost.Build from Boost C++ Libraries 1.81.0
Install from source.
Downloadboost_1_81_0.zip
toC:\Boost\src\boost_1_81_0.zip
.
Extract toC:\Boost\src\boost_1_81_0
.
Install Boost.Build toC:\boost-build
.
cd C:\Boost\src\boost_1_81_0\tools\buildbootstrap.bat.\b2 install
Boost C++ Libraries 1.81.0
Install from source (this will take a very long time).
Downloadboost_1_81_0.zip
toC:\Boost\src\boost_1_81_0.zip
.
Extract toC:\Boost\src\boost_1_81_0
.
Install versioned Boost C++ Libraries toC:\Boost
.
cd C:\Boost\src\boost_1_81_0bootstrap.bat.\b2 --layout=system variant=release address-model=64 install
From acmd
window install the system packages. At the end of thisprocess, the machine will reboot, so make sure there is no one elselogged in.
wingetinstall--exact --idGit.Gitgitclonehttps://github.com/tee3/homedir.gitC:\Users\administrator\Development\homedircdC:\Users\administrator\Development\homedirinstall_bootstrap_packages_windowsshutdown/r
This is a Ubunutu-based command-line system within Windows 10Anniversary Edition. As such, it is supported as if it were a Debiansystem above.
Enable theDeveloper Mode radio button inSettings->Update &security->For developers.
Enable theWindows Subsystem for Linux inControlPanel->Programs->Turn Windows features on or off and follow theinstructions and reboot.
Runbash
within aCommand Prompt and agree to install Ubuntu.
Enteradministrator
when asked for a user.
Exit theCommand Prompt.
RunBash on Ubuntu for Windows from theStart Menu, whichwill log in asadministrator
.
Add a userUSER
by running the following command.
sudo /usr/sbin/adduser USER
Exit theBash on Ubuntu for Windows shell.
From the login terminal of the system, log in asadministrator
byrunningBash on Ubuntu for Windows and then installgit
, clonethetee3/homedir
repository and install the system packages.
sudoapt-getinstallgitgit clone https://github.com/tee3/homedir.git ~/Development/homedircd ~/Development/homedir./install_bootstrap_packages_debian
Note that Windows Subsystem for Linux is supported as it is aapt-get
-based system. While this is a true Linux system, there arestill some limitations. It is based on Ubuntu (and an earlier versionof Debian), and so runs some older packages. It also seems as if theinit
system is not run as expected.
The following provides somead-hoc workarounds for theselimitations.
To switch to theadministrator
user, run thelxrun
command asshown below.
lxrun/setdefaultuseradministrator
To update the package databases, run thelxrun
command as shownbelow.
lxrun/update
Installing system packages should be done as necessary as it updatesthe system as well as installs system packages added after the initialbootstrap of the system.
NOTE: Installing system packages should really be generalized a bitsince packages required for work are the same regardless of whichsystem you are on. A package list with a script for each system thatprocesses the list and turns it into commands to Homebrew,apt-get
,yum
, etc. would be an interesting approach.
The system install scripts are written in the least-common denominatorlanguage for the system on which it runs.
To install system packages for Fedora-based systems (viayum
), runthe following script as a user withsudo
permission.
./install_system_packages_fedora
To install system packages for Debian-based systems (viaapt-get
),run the following script as a user withsudo
permission.
./install_system_packages_debian
To install system packages for macOS (via Homebrew), run the followingscript as the administrator of the system. Note that this does notusesudo
as Homebrew does not require it.
./install_system_packages_macos
To install system packages for Windows, run the following script asthe administrator of the system.
install_system_packages_windows
To set up a new system or update an existing system for a user, runthe following commands when logged in as that user. Note that allsystem packages should be installed prior to theinstall
script viathe bootstrap procedure above so all support applications are properlyset up.
Theinstall
script checks for the requirements and then helps theuser set up a home directory. There is special support for featuresthat require it. It is not recommended to install the~/opt/local
directories or the scripting language tools for theadministrator
user.
Note that theinstall
script and its supported scripts requirePython.
python3install
Each supported feature provideslocal
,machine
, oruser
-specificfiles for configuration local to a particular machine or user that isnot appropriate to put on a public server. This includes things likenames, email addresses, keys, certificates, and other sensitiveinformation.
sh
This contains support for the Bourne Shell (sh) via the~/.profile
file.
The configuration system generates a~/.profile.local
file for localconfiguration. It is initially empty.
bash
This contains support for the Bourne Again Shell (Bash) by including~/.bash_profile
,~/.bashrc
,~/.bash_logout
, and~/.bashrc.local
files. This builds off the Bourne Shell support.
The configuration system generates a~/.bashrc.local
file for localconfiguration. It is initially empty.
zsh
This contains support for the Z Shell (bash) by including~/.zprofile
and~/.zshrc
files. This builds off the Bourne Shellsupport.
The configuration system generates a~/.zshrc.local
file for localconfiguration. It is initially empty.
cmd
This contains some minimal support forcmd
such that HOME is setproperly and development tools are properly set up. This models howbash
is initialized by adding a~/.cmdrc.bat
file (and~/.cmdrc.local.bat
file) that is executed on startingcmd
.
The configuration system generates a~/.cmdrc.local.bat
file forlocal configuration. It is initially empty.
This contains a~/.emacs
file, which installs and configures Emacspackages automatically viause-package
andpackage
.
The configuration system generates~/.emacs.machine.el
and~/.emacs.user.el
for local machine and user configuration. Thesefiles initially contain only boilerplate for Emacs Lisp file. Theconfiguration system optionally will provide the user with suggestionsto set up these files to properly set the system’s name and the user’sname and email address since these are often detected incorrectly byEmacs.
There is a also a very minimal Emacs configuration file named~/.emacs.minimal.el. This can beinstalled to~/.emacs
manually on systems that do not require a fullhomedir installation.
It can also be used to experiment with a minimally-configured Emacs.Run the following command to use Emacs with the minimal Emacsconfiguration.
emacs-nw-q-l ~/.emacs.minimal.el
This is not exactly the same as running Emacs with~/.emacs
, but itis close enough for experimentation.
This includes~/.ssh/config
file to configure SSH. This is intendedto be portable across all systems including Windows.
The~/.ssh/config
file includes all files in the directory~/.ssh/config.d
. This is intended for configuration parameters thatare sensitive and should not be shared on a public server.
The user is required to move the current contents of~/.ssh/config
before migrating to this approach since it is a fairly complicatedprocess. One approach is to move the existing~/.ssh/config
file toa file in~/.ssh/config.d
. This will override all settings in theshared~/.ssh/config
file.
This includes~/.gitconfig
,~/.gitignore
, and~/.gitattributes
files to configure Git. This is intended to be portable across allsystems including Windows.
The~/.gitconfig
file includes files named~/.gitconfig.machine
and~/.gitconfig.user
for machine-specific and user-specificconfiguration parameters. This is intended for configurationparameters that are sensitive and should not be shared on a publicserver.
The install script will migrate the user name/email from~/.gitconfig
to~/.gitconfig.user
as required.
~/opt/local
Theinstall
script will build a directory structure at~/opt/local
if it does not exist.
This is populated with source packages described below.
Python packages are installed using the user protocol and arequirements file defines the installed Python packages.
Seeinstall_python_packages.txt for alist of installed Python packages.
Ruby gems are installed using the user protocol and a Gemfile definesthe installed Ruby packages.
Seeinstall_ruby_packages.gemfilefor a list of installed Ruby packages.
Rust programs are using installed for the local user, which is thedefault.
Seeinstall_rust_packages.txt for alist of installed Rust packages.
Node.js modules are installed to the user’s home directory under~/.node_modules
and a text file defines the installed Node.jsmodules.
See theinstall_node_packages.txt for alist of installed Node.js packages.
Note that this might be done more cleanly by using apackage.json
file and thenpm
install machinery for it directly instead of a textfile ofnpm
package names. Unfortunately, I have not figured outhow to do this yet.
Go packages are installed to the user’s home directory under~/.go
and a text file defines the installed Go packages.
See theinstall_go_packages.txt for alist of installed Go packages.
There is a script to support installing packages that are notsupported by a standard package manager or require specialconsideration.
tee3-c-style
msvc-c-style
git-svn-update-externals
boost
See the bottom of thescript for an moreup-to-date list of source packages.
There is a script to install any version of Boost C++ Libraries into adirectory in the~/opt/local/src/boost
directory.
See thescript for the details.