Just another snippet of code that can be implemented somewhere:
set-perms.sh
#!/bin/bash
# Function to change ownership of the www folder
change_ownership() {
sudo chown -R "$1":www-data /var/www
echo "Ownership of the www folder has been set to $1:www-data."
}
# Loop until a valid username is provided
while true; do
# Prompt the user to enter the desired username
read -p "Enter the username for permissions: " username
# Check if the username provided exists
if id "$username" &>/dev/null; then
change_ownership "$username"
break # Exit the loop if a valid username is provided
else
echo "Error: User $username does not exist."
fi
done
echo "done!"
You can give your Debian installation a static IP address by following these steps:
1. Determine your network interface name: Use the following command to determine the name of your network interface:
ip addr
This will display information about all of your network interfaces. Look for the interface that you want to configure with a fixed IP address. The interface name will be listed on the left-hand side of the output (e.g. eth0, enp0s3, etc.)
2. Edit the network configuration file: Use a text editor to edit the /etc/network/interfaces file. For example, you can use the nano editor by running the following command:
sudo nano /etc/network/interfaces
3. Configure the network interface: Add the following lines to the file, replacing the interface name and IP address with your own values:
For example, if your network interface name is “eth0” and you want to set the IP address to “192.168.0.10”, the subnet mask to “255.255.255.0”, the default gateway to “192.168.0.1”, and the DNS server to “8.8.8.8”, the configuration would look like this:
4. Save and close the file: Press Ctrl+O to save the file, and then press Ctrl+X to close the editor.
5. Restart the networking service: Use the following command to restart the networking service and apply the changes:
sudo systemctl restart networking
After you’ve completed these steps, your Debian installation should have a fixed IP address. You can verify the configuration by using the “ip addr” command again and looking for the interface that you configured.
More info here: https://wiki.debian.org/NetworkConfiguration
Thanks to https://fosstodon.org/@HankB for the tips and better choice of words!
* Disable the Display Manager: The Display Manager is the graphical login screen that appears when you start up Debian. You can disable it by stopping the service and preventing it from starting at boot time. Use the following command to stop the service:
sudo systemctl stop display-manager.service
And then disable the service from starting at boot time:
sudo systemctl disable display-manager.service
* Remove the GUI packages: You can remove the GUI packages from your Debian installation by using the following command:
sudo apt-get remove task-gnome-desktop
This will remove the GNOME desktop environment and all its associated packages. If you’re using a different desktop environment, replace “gnome” with the name of your desktop environment.
* Reboot your system: Once you’ve disabled the Display Manager and removed the GUI packages, you’ll need to reboot your system for the changes to take effect. Use the following command to reboot your system:
sudo reboot
After the reboot, your Debian installation should boot into a command-line interface without any GUI.
Keep in mind that disabling the GUI permanently may make some tasks more difficult or time-consuming to perform. It’s recommended to proceed with caution and ensure that you have a backup plan in case you need to re-enable the GUI later.
The following has been suggested by https://fosstodon.org/@HankB :
So a new release came out and it is important to get this update as soon as possible! This manual is a transcript of the way that I have updated my Mastodon instance. Please make sure you make proper backups and use your brain while updating things.
A guide to making a Mastodon backup can be found here.
Linux flavour: Debian
Update from: 4.2.xx
Log into your server
su - mastodon
cd /home/mastodon/live
git fetch --tags
git checkout [type the most recent version here, starting with the letter v. For example; v4.2.5
git checkout v4.2.10
If you get a ruby version error, please see bottom of this article for a fix! bundle install
yarn install
RAILS_ENV=production bundle exec rails db:migrate
#NOTE: You might get a ruby error which then suggests you to enter the command "bundle install". Do that and then run the RAILS command again.
My system was unable to find the required v3.2.3 of Ruby and I have fixed this by doing the following steps:
Please make sure that your path is correct.
git -C ~/.rbenv/plugins/ruby-build pull
rbenv install 3.2.3
*WAIT TILL DONE* (it may take a little while)
To check all the installed versions type:
rbenv versions
To set v3.2.3 as the global version, type:
rbenv global 3.2.3
To double-check the active, installed version, type:
rbenv versions
Done!
This manual is a transcript of the way that I have updated my Mastodon instance. Please make sure you make proper backups and use your brain while updating things.