Please upgrade your system before running the install script. (
apt-get update && apt-get upgrade -y
)
wget -qO cospace.sh releases.twigex.com/install.sh && sudo bash cospace.sh
sudo adduser cospace
sudo usermod -aG sudo cospace
su - cospace
sudo apt update
sudo apt install -y mariadb-server
This will take you through a series of prompts where you can make some changes to your MariaDB installation’s security options. The first prompt will ask you to enter the current database root password. Since you have not set one up yet, press ENTER to indicate “none”.
sudo mysql_secure_installation
From there, you can press Y to all prompts and enter password as password when asked for "Set root password?"
sudo mariadb
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
CREATE DATABASE cospace;
FLUSH PRIVILEGES;
exit
sudo apt update
sudo apt install -y redis-server
sudo sed -i "s|# requirepass foobared|requirepass password|i" /etc/redis/redis.conf
sudo service redis restart
cospace
usersu cospace
cd ~
mkdir ./cospace
Donwload the corresponding version and use wget
command directly on the server:
wget https://releases.twigex.com/cospace-0.2.3-ubuntu-20-04-amd64.tar.gz
wget https://releases.twigex.com/cospace-0.2.3-ubuntu-22-04-amd64.tar.gz
wget https://releases.twigex.com/cospace-0.2.3-debian-10-amd64.tar.gz
wget https://releases.twigex.com/cospace-0.2.3-debian-11-amd64.tar.gz
Extract the archive to /cospace
directory (Please change the command accordingly to your Linux version)
tar -xvf cospace-0.2.3-ubuntu-22-04-amd64.tar.gz --directory ./cospace
cd cospace
./cloud install
./cloud storage create local --path="data/files" --name="Local Storage"
or
./cloud storage create s3 --path="data/files" --name="S3" --endpoint="my.endpoint.com" --accesskey="my access key" --secretkey="my secret key" --ssl=true --bucket="bucket name"
./cloud user create --username john --email john@twigex.com --firstname John --lastname Appleseed --password apple --role system_admin
tee cloud.sh <<EOF
#!/bin/bash
cd /home/cospace/cospace/
./cloud start --port 3000
EOF
chmod u+x cloud.sh
sudo tee /etc/systemd/system/cospace.service <<EOF
[Unit]
Description=Run cospace service
DefaultDependencies=no
After=network.target
[Service]
Type=simple
User=cospace
Group=root
ExecStart=/home/cospace/cospace/cloud.sh
TimeoutStartSec=0
RemainAfterExit=yes
[Install]
WantedBy=default.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable cospace.service
sudo systemctl start cospace.service
sudo systemctl status cospace.service
Since Nginx is available in Ubuntu’s default repositories, it is possible to install it from these repositories using the apt packaging system.
sudo apt install -y nginx
sudo systemctl enable nginx
sudo tee /etc/nginx/sites-available/cospace.conf <<'EOF'
upstream backend {
server localhost:3000;
keepalive 32;
}
server {
listen 80;
server_name cloud.mydomain.tld;
location / {
client_max_body_size 50M;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
}
EOF
make sure you replace the domain name cloud.mydomain.tld with your own!
sudo ln -s /etc/nginx/sites-available/cospace.conf /etc/nginx/sites-enabled/
sudo nginx -t
If you get an error, reopen the server block file and check for any typos or missing characters.
sudo systemctl reload nginx
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d cloud.mydomain.tld
Read and answer questions accordingly.
make sure you replace the domain name cloud.mydomain.tld with your own!
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):