Skip to content

Instantly share code, notes, and snippets.

@andreasbotsikas
Last active December 20, 2017 01:59
Show Gist options
  • Save andreasbotsikas/34b108f270bc7111bfc7c323bd3bd327 to your computer and use it in GitHub Desktop.
Save andreasbotsikas/34b108f270bc7111bfc7c323bd3bd327 to your computer and use it in GitHub Desktop.
RPI mods
# To log in as root user first we have to enable it, to do so type the following command whilst logged in as the default pi user:
sudo passwd root
# Disable autologin
raspi-config
reboot
# And then logout back in as the user 'root' using the password you just created. Now we can rename the the default pi user name. The following method renames the user 'pi' to 'newname', replace this with whatever you want. Type the command:
usermod -l newname pi
# Now the user name has been changed the user's home directory name should also be changed to reflect the new login name:
usermod -m -d /home/newname newname
# Now logout and login back in as newname. You can change the default password from raspberry to something more secure by typing following command and entering a new password when prompted:
passwd
# If you wish you can disable the root user account again but first double check newname still has 'sudo' privileges. Check the following update command works:
sudo apt-get update
# If it works then you can disable the root account by locking the password:
sudo passwd -l root 
# Create a 2.1 app in the windows host
dotnet new console -n rpihello
cd rpihello
dotnet restore --source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
# Create a nuget.config file
notepad++ nuget.config
/*
Add the following and ensure encoding is utf-8
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="dotnet-myget" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
  </packageSources>
</configuration>
*/
dotnet build
# Compress the file
cd bin\Debug
powershell
Compress-Archive -Path .\netcoreapp2.1\ -DestinationPath .\app.zip
# Ship to rpi
bash
scp app.zip [email protected]:/home/username/
# Connect to rpi
ssh [email protected]
unzip app.zip
cd netcoreapp2.1
dotnet rpihello.dll
# If you have nuget references use
dotnet publish -r linux-arm
PS C:\temp\rpihello\bin\Debug\netcoreapp2.1\linux-arm> Compress-Archive -Path .\Publish -Destination Path .\app.zip
# ship the zip and extact, go to folder and give execution
chmod u+x rpihello
./rpihello
# See https://github.com/OmniSharp/omnisharp-vscode/wiki/Remote-Debugging-On-Linux-Arm for remote debugging
# install vim
sudo apt-get install vim
# install sshd
sudo apt-get install openssh-server
# start server
sudo service ssh start
# status
service ssh status
# configuration (disable X11 for example)
sudo vi /etc/ssh/sshd_config
# restart to apply changes
sudo service ssh restart
# To enable auto start
sudo systemctl enable ssh.socket
# Install system components.
sudo apt-get update
sudo apt-get install curl libunwind8 gettext apt-transport-https
# Download runtime
mkdir ~/dotnet & curl -sSL https://dotnetcli.blob.core.windows.net/dotnet/Runtime/master/dotnet-runtime-latest-linux-arm.tar.gz | tar xvzf /dev/stdin -C ~/dotnet
# move to usr/local
sudo mv dotnet/ /usr/local/
# create symbolic link
sudo ln -s /usr/local/dotnet/dotnet /usr/bin/dotnet
# see info
dotnet --info
# Optionally install debugger
curl -sSL https://aka.ms/getvsdbgshbeta | bash /dev/stdin -r linux-arm -v latest -l ~/vsdbg
# From the remote machine
ssh-keygen -t rsa
ssh-copy-id [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment