-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_rasp.sh
More file actions
265 lines (187 loc) · 7.63 KB
/
install_rasp.sh
File metadata and controls
265 lines (187 loc) · 7.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#######################
# Mount USB Harddrives permanently
sudo blkid
## --> COPY value of PARTUUID
sudo nano /etc/fstab
# addlines:
#PARTUUID=68f1ed7b-01 /mnt/usbstorage ntfs ntfs auto,nofail,sync,users,rw 0 0
#PARTUUID=006e39f4-01 /mnt/usbstorage2 ntfs ntfs auto,nofail,sync,users,rw 0 0
sudo mkdir -p /mnt/usbstorage
sudo mkdir -p /mnt/usbstorage2
sudo chown root:root /mnt/usbstorage
sudo chmod 777 /mnt/usbstorage
sudo chown root:root /mnt/usbstorage2
sudo chmod 777 /mnt/usbstorage2
### Send harddrives to standby automatically
sudo apt-get install hdparm
### Set spindown timer for external harddrive to 25seconds, otherwise the harddrives would spin continiously
sudo hdparm -S5 /dev/sda
sudo hdparm -S5 /dev/sdb
######################
# Install Samba
sudo apt-get install samba samba-common smbclient
## Check if Samba is up and running
sudo service smbd status
sudo service nmbd status
sudo nano /etc/samba/smb.conf
### -> Add at the end
#[MiniCloud]
#path = /mnt/usbstorage
#writeable=Yes
#create mask=0777
#directory mask=0777
#public=yes
#[MegaCloud]
#path = /mnt/usbstorage2
#writeable=Yes
#create mask=0777
#directory mask=0777
#public=yes
#####################
# Install CUPS and printer (SAMSUNG) drivers and Airprint to print from iPad
sudo apt-get install cups
sudo apt-get install printer-driver-gutenprint
sudo apt-get install printer-driver-splix
sudo cupsctl --remote-admin
sudo lsusb
sudo cupsctl --share-printers
sudo cupsctl --remote-printers
sudo usermod -aG lpadmin pi
sudo apt-get install cups-pdf
sudo apt-get install libcups2-dev
sudo apt-get install python-cups
sudo mkdir /opt/airprint
cd /opt/airprint
sudo wget -O airprint-generate.py --no-check-certificate https://raw.github.com/tjfontaine/airprint-generate/master/airprint-generate.py
sudo chmod 755 airprint-generate.py
sudo ./airprint-generate.py
sudo mv AirPrint-*.service /etc/avahi/services
sudo ./airprint-generate.py -d /etc/avahi/services
sudo /etc/init.d/avahi-daemon restart
sudo /etc/init.d/cups restart
#####################
# Install Sane
sudo apt install sane-utils
lsusb
## -> Bus 001 Device 005: ID 04e8:3441 Samsung Electronics Co., Ltd
sudo scanimage -L
## -> device `xerox_mfp:libusb:001:005' is a Samsung Samsung SCX-3200 Series multi-function peripheral
## Configure sane-Daemon to accept incoming connections
sudo nano /etc/sane.d/saned.conf
## --> Access list 192.168.0.0/24 --> Accept incoming from all over the network
## Start sane Service
systemctl status saned.socket
sudo systemctl start saned.socket
sudo systemctl enable saned.socket
systemctl status saned.socket
## Configure Backend for network connections
sudo nano /etc/sane.d/net.conf
## add pi IP-Adress e.g.: -> 192.168.0.24
sudo nano /etc/default/saned
## add: -> RUN=yes
sudo sane-find-scanner
sudo ls -l /dev/bus/usb/001 # <- USB depends on where the device is connected
## Output shows you the owner of the scanner -> usualls "lp"
## Add owner of the scanner (lp) to the the saned group
sudo adduser saned lp
## Disable WiFi OR LAN in raspberry pi (desktop)
####################
# Install Shiny-Server
# Install R Shiny Server (stable) on Raspberry Pi 4, tested December 22, 2019
# References: https://github.com/rstudio/shiny-server/issues/347
# and: https://www.rstudio.com/products/shiny/download-server/
# and: https://cloud.r-project.org/bin/linux/debian/#debian-stretch-stable
# and: https://github.com/rstudio/shiny-server/wiki/Building-Shiny-Server-from-Source
# Start at home directory
cd
# Update/Upgrade Raspberry Pi
sudo apt-get -y update && sudo apt-get -y upgrade
# Install R
sudo apt-get -y install r-base
# Install system libraries (dependences for some R packages)
sudo apt-get -y install libssl-dev libcurl4-openssl-dev libboost-atomic-dev
## Uninstall/Reinstall Pandoc
sudo apt-get -y remove pandoc
sudo apt-get -y install pandoc
## Install dependencies of package later
sudo su - -c "R -e \"install.packages('Rcpp', repos='https://cran.rstudio.com/')\""
sudo su - -c "R -e \"install.packages('BH', repos='https://cran.rstudio.com/')\""
# Install R Packages
git clone https://github.com/r-lib/later.git
sed -i -e 's/PKG_LIBS = -pthread/PKG_LIBS = -pthread -lboost_atomic/g' later/src/Makevars.in
sudo R CMD INSTALL later
sudo su - -c "R -e \"install.packages('httpuv', repos='https://cran.rstudio.com/')\""
sudo su - -c "R -e \"install.packages('shiny', repos='https://cran.rstudio.com/')\""
sudo su - -c "R -e \"install.packages('plotly', repos='https://cran.rstudio.com/')\""
sudo su - -c "R -e \"install.packages('rmarkdown', repos='https://cran.rstudio.com/')\""
# Install cmake: https://github.com/rstudio/shiny-server/wiki/Building-Shiny-Server-from-Source
wget http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz
tar xzf cmake-2.8.11.2.tar.gz
cd cmake-2.8.11.2
./configure
make
sudo make install
sudo apt-get -y update && sudo apt-get -y upgrade
## Return to home directory
cd
# Install Shiny Server as per https://github.com/rstudio/shiny-server/issues/347
## Clone the repository from GitHub
git clone https://github.com/rstudio/shiny-server.git
## Edit external/node/install-node.sh for ARM processor
cd shiny-server/
### update NODE_SHA256 as per: https://nodejs.org/dist/[CURRENTVERSION]/SHASUMS256.txt
sudo nano external/node/install-node.sh
## change Checksum NODE_SHA256, NODE_FILENAME and NODE_URL e.g.:
# NODE_SHA256=bc7d4614a52782a65126fc1cc89c8490fc81eb317255b11e05b9e072e70f141d
#
# download_node () {
# local NODE_FILENAME="node-v12.14.0-linux-armv7l.tar.xz"
# local NODE_URL="https://nodejs.org/dist/v12.14.0/${NODE_FILENAME}"
# local NODE_ARCHIVE_DEST="/tmp/${NODE_FILENAME}"
# echo "Downloading Node ${NODE_VERSION} from ${NODE_URL}"
## Build shiny-Server
DIR=`pwd`
PATH=$DIR/bin:$PATH
mkdir tmp
cd tmp
PYTHON=`which python`
sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DPYTHON="$PYTHON" ../
sudo make
mkdir ../build
(cd .. && sudo ./external/node/install-node.sh)
(cd .. && ./bin/npm --python="${PYTHON}" install --no-optional)
(cd .. && ./bin/npm --python="${PYTHON}" rebuild)
sudo make install
## Return to home directory
cd
## Copy Shiny Server directory to system location
sudo cp -r shiny-server/ /usr/local/
# Place a shortcut to the shiny-server executable in /usr/bin
sudo ln -s /usr/local/shiny-server/bin/shiny-server /usr/bin/shiny-server
#Create shiny user. On some systems, you may need to specify the full path to 'useradd'
sudo useradd -r -m shiny
# Create log, config, and application directories
sudo mkdir -p /var/log/shiny-server
sudo mkdir -p /srv/shiny-server
sudo mkdir -p /var/lib/shiny-server
sudo chown shiny /var/log/shiny-server
sudo mkdir -p /etc/shiny-server
# Return to Shiny Server directory and set shiny-server.conf
cd shiny-server
sudo cp config/default.config /etc/shiny-server/shiny-server.conf
sudo cp -r /usr/local/shiny-server/ext/pandoc .
sudo rm -r /usr/local/shiny-server/ext/pandoc/
# Setup for start at boot: http://docs.rstudio.com/shiny-server/#systemd-redhat-7-ubuntu-15.04-sles-12
# and: https://www.raspberrypi-spy.co.uk/2015/10/how-to-autorun-a-python-script-on-boot-using-systemd/
sed -i -e "s:ExecStart=/usr/bin/env bash -c 'exec /opt/shiny-server/bin/shiny-server >> /var/log/shiny-server.log 2>&1':ExecStart=/usr/bin/shiny-server:g" config/systemd/shiny-server.service
sed -i -e 's:/env::' config/systemd/shiny-server.service
sudo cp config/systemd/shiny-server.service /lib/systemd/system/
sudo chmod 644 /lib/systemd/system/shiny-server.service
sudo systemctl daemon-reload
sudo systemctl enable shiny-server.service
# Final Shiny Server Setup
sudo cp samples/welcome.html /srv/shiny-server/index.html
sudo cp -r samples/sample-apps/ /srv/shiny-server/
sudo shiny-server &
# Return to home directory
cd