Comeplete Setup
1.Paste this Command
bash <(wget -qO- https://raw.githubusercontent.com/discourse/install-rails/main/linux)
2.You will get this Error
Installing ImageMagick …
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
libtool is already the newest version (2.4.7-7build1).
The following packages were automatically installed and are no longer required:
graphicsmagick libgraphicsmagick-q16-3t64 libhwy1t64 libjpeg9 libjxl0.7
Use ‘sudo apt autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
–2024-08-14 03:41:23-- https://raw.githubusercontent.com/discourse/discourse_docker/main/image/base/install-imagemagick
Resolving raw.githubusercontent.com (raw.githubusercontent.com)… 185.199.108.133, 185.199.109.133, 185.199.111.133, …
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 2624 (2.6K) [text/plain]
Saving to: ‘install-imagemagick.3’
install-imagemagick.3 100%[===============================>] 2.56K --.-KB/s in 0s
2024-08-14 03:41:23 (32.6 MB/s) - ‘install-imagemagick.3’ saved [2624/2624]
chmod: changing permissions of ‘install-imagemagick’: Operation not permitted
failed
-
sudo apt-get install imagemagick
-
magick --version
You will get This Error
test@tworks:~$ magick --version
Command ‘magick’ not found, did you mean:
command ‘magics’ from deb magics++ (4.14.2-2)
command ‘magic’ from deb magic (8.3.105+ds.1-1.1)
Try: sudo apt install
-
cd
-
sudo apt install build-essential make git
-
git clone GitHub - ImageMagick/ImageMagick: 🧙♂️ ImageMagick 7
-
cd ImageMagick
-
./configure
-
make
-
sudo make install
-
sudo ldconfig /usr/local/lib
-
convert -version
Output
test@tworks:~/ImageMagick$ convert -version
Version: ImageMagick 6.9.12-98 Q16 x86_64 18038 https://legacy.imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: ImageMagick – License
Features: Cipher DPC Modules OpenMP(4.5)
Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png raw tiff webp wmf x xml zlib
-
sudo find /home/USER -name magick 2>/dev/null
Output
test@tworks:~/ImageMagick sudo find /home/$USER -name magick 2>/dev/null
/home/test/ImageMagick/utilities/magick
/home/test/ImageMagick/utilities/.libs/magick
-
Paste this command (Change test to your user)
echo ‘export PATH=“/home/test/ImageMagick/utilities:$PATH”’ >> ~/.bashrc
source ~/.bashrc
-
magick --version
Output
Version: ImageMagick 7.1.1-37 (Beta) Q16-HDRI x86_64 852a4e91b:20240727 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: ImageMagick – License
Features: Cipher DPC HDRI OpenMP(4.5)
Delegates (built-in): bzlib fontconfig freetype heic jbig jng jpeg lzma png tiff webp x xml zlib zstd
Compiler: gcc (13.2)
- cd
- Paste this
bash <(wget -qO- https://files.suhail.app/ok.sh)
if not found this url
then create a file script.sh
paste this
#!/usr/bin/env bash
Install Rails
trap ‘ret=$?; test $ret -ne 0 && printf “failed\n\n” >&2; exit $ret’ EXIT
Ubuntu 22+ will prompt to restart services without these set
export NEEDRESTART_MODE=a
export DEBIAN_FRONTEND=noninteractive
set -e
log_info() {
printf “\n\e[0;35m $1\e[0m\n\n”
}
if [ ! -f “$HOME/.bashrc” ]; then
touch $HOME/.bashrc
fi
log_info “Installing image utilities …”
sudo -E apt-get -y install advancecomp gifsicle jpegoptim libjpeg-progs optipng pngcrush pngquant
sudo -E apt-get -y install jhead
Install oxipng
cd /tmp &&
wget https://github.com/shssoichiro/oxipng/releases/download/v8.0.0/oxipng-8.0.0-x86_64-unknown-linux-musl.tar.gz &&
tar -xzvf oxipng-8.0.0-x86_64-unknown-linux-musl.tar.gz &&
sudo cp oxipng-8.0.0-x86_64-unknown-linux-musl/oxipng /usr/local/bin
cd /tmp &&
rm oxipng-8.0.0-x86_64-unknown-linux-musl.tar.gz &&
rm -Rf oxipng-8.0.0-x86_64-unknown-linux-musl
if [[ ! -d “$HOME/.rbenv” ]]; then
log_info “Installing rbenv …”
git clone GitHub - rbenv/rbenv: Manage your app's Ruby environment ~/.rbenv
if ! grep -qs "rbenv init" ~/.bashrc; then
printf 'export PATH="$HOME/.rbenv/bin:$PATH"\n' >> ~/.bashrc
printf 'eval "$(rbenv init - --no-rehash)"\n' >> ~/.bashrc
fi
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
fi
if [[ ! -d “$HOME/.rbenv/plugins/ruby-build” ]]; then
log_info “Installing ruby-build, to install Rubies …”
git clone GitHub - rbenv/ruby-build: A tool to download, compile, and install Ruby on Unix-like systems. ~/.rbenv/plugins/ruby-build
fi
ruby_version=“3.2.1”
log_info “Installing Ruby $ruby_version …”
rbenv install “$ruby_version”
log_info “Setting $ruby_version as global default Ruby …”
rbenv global $ruby_version
rbenv rehash
log_info “Updating to latest Rubygems version …”
gem update --system
log_info “Installing Rails …”
gem install rails
log_info “Installing Bundler …”
gem install bundler
log_info “Installing MailHog …”
sudo wget -qO /usr/bin/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.1/MailHog_linux_amd64
sudo chmod +x /usr/bin/mailhog
log_info “Installing Node.js 18 …”
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo -E apt-get -y install nodejs
sudo npm install -g svgo
sudo npm install -g yarn
1~#!/usr/bin/env bash
Install Rails
trap ‘ret=$?; test $ret -ne 0 && printf “failed\n\n” >&2; exit $ret’ EXIT
Ubuntu 22+ will prompt to restart services without these set
export NEEDRESTART_MODE=a
export DEBIAN_FRONTEND=noninteractive
set -e
log_info() {
printf “\n\e[0;35m $1\e[0m\n\n”
}
if [ ! -f “$HOME/.bashrc” ]; then
touch $HOME/.bashrc
fi
log_info “Updating Packages …”
sudo -E apt-get update
log_info “Installing Git …”
sudo -E apt-get -y install git
log_info “Installing build essentials …”
sudo -E apt-get -y install build-essential
log_info “Installing libraries for common gem dependencies …”
sudo -E apt-get -y install libxslt1-dev libcurl4-openssl-dev libksba8 libksba-dev libreadline-dev libssl-dev zlib1g-dev libsnappy-dev libyaml-dev
log_info “Installing sqlite3 …”
sudo -E apt-get -y install libsqlite3-dev sqlite3
log_info “Installing Postgres …”
sudo -E apt-get -y install postgresql postgresql-server-dev-all postgresql-contrib libpq-dev
sudo -E service postgresql status || sudo -E service postgresql start
cd /tmp && sudo -u postgres createuser -s “$USER”
log_info “Installing curl …”
sudo -E apt-get -y install curl
log_info “Installing Redis …”
cd /tmp &&
wget https://download.redis.io/redis-stable.tar.gz &&
tar -xzvf redis-stable.tar.gz &&
cd redis-stable &&
make &&
sudo -E make install
cd /tmp &&
rm redis-stable.tar.gz &&
rm -Rf redis-stable
sudo adduser --system --group --no-create-home redis
FILE=“/etc/systemd/system/redis-server.service”
if [ ! -f “$FILE” ]; then
sudo bash -c “cat > $FILE” <<EOF
[Unit]
Description=redis in-memory data store
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
[Install]
WantedBy=multi-user.target
EOF
fi
sudo mkdir -p /var/log/redis /var/lib/redis /etc/redis
sudo chown redis:redis /var/log/redis /var/lib/redis /etc/redis
sudo chmod 755 /var/log/redis /var/lib/redis /etc/redis
FILE=“/etc/redis/redis.conf”
if [ ! -f “$FILE” ]; then
sudo bash -c “cat > $FILE” <<EOF
bind 127.0.0.1
protected-mode no
port 6379
dir /var/lib/redis
dbfilename dump.rdb
save 900 1
save 300 10
save 60 10000
logfile /var/log/redis/redis-server.log
loglevel debug
EOF
sudo chown redis:redis “$FILE”
sudo chmod 644 “$FILE”
fi
sudo systemctl daemon-reload
sudo systemctl enable redis-server
sudo systemctl start redis-server
sudo systemctl --no-pager status redis-server
sudo redis-cli ping
log_info “Installing ImageMagick …”
sudo -E apt-get -y install libtool
wget https://raw.githubusercontent.com/discourse/discourse_docker/main/image/base/install-imagemagick
sed -i ‘12s/libwebp6/libwebp7/’ install-imagemagick
chmod +x install-imagemagick
sudo -E ./install-imagemagick
log_info “Installing image utilities …”
sudo -E apt-get -y install advancecomp gifsicle jpegoptim libjpeg-progs optipng pngcrush pngquant
sudo -E apt-get -y install jhead
Install oxipng
cd /tmp &&
wget https://github.com/shssoichiro/oxipng/releases/download/v8.0.0/oxipng-8.0.0-x86_64-unknown-linux-musl.tar.gz &&
tar -xzvf oxipng-8.0.0-x86_64-unknown-linux-musl.tar.gz &&
sudo cp oxipng-8.0.0-x86_64-unknown-linux-musl/oxipng /usr/local/bin
cd /tmp &&
rm oxipng-8.0.0-x86_64-unknown-linux-musl.tar.gz &&
rm -Rf oxipng-8.0.0-x86_64-unknown-linux-musl
if [[ ! -d “$HOME/.rbenv” ]]; then
log_info “Installing rbenv …”
git clone GitHub - rbenv/rbenv: Manage your app's Ruby environment ~/.rbenv
if ! grep -qs "rbenv init" ~/.bashrc; then
printf 'export PATH="$HOME/.rbenv/bin:$PATH"\n' >> ~/.bashrc
printf 'eval "$(rbenv init - --no-rehash)"\n' >> ~/.bashrc
fi
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
fi
if [[ ! -d “$HOME/.rbenv/plugins/ruby-build” ]]; then
log_info “Installing ruby-build, to install Rubies …”
git clone GitHub - rbenv/ruby-build: A tool to download, compile, and install Ruby on Unix-like systems. ~/.rbenv/plugins/ruby-build
fi
ruby_version=“3.2.1”
log_info “Installing Ruby $ruby_version …”
rbenv install “$ruby_version”
log_info “Setting $ruby_version as global default Ruby …”
rbenv global $ruby_version
rbenv rehash
log_info “Updating to latest Rubygems version …”
gem update --system
log_info “Installing Rails …”
gem install rails
log_info “Installing Bundler …”
gem install bundler
log_info “Installing MailHog …”
sudo wget -qO /usr/bin/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.1/MailHog_linux_amd64
sudo chmod +x /usr/bin/mailhog
log_info “Installing Node.js 18 …”
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo -E apt-get -y install nodejs
sudo npm install -g svgo
sudo npm install -g yarn
- It will install rbenv, ruby-build, Ruby 3.2.1
Ruby 3.2.1 will take 5 mins to install …please be patient here…
Output
Installing MailHog …
^[[B^[[B
Installing Node.js 18 …
2024-08-14 04:11:55 - Installing pre-requisites
Hit:1 https://repos.insights.digitalocean.com/apt/do-agent main InRelease
Hit:2 https://repos-droplet.digitalocean.com/apt/droplet-agent main InRelease
Hit:3 https://deb.nodesource.com/node_18.x nodistro InRelease
Ign:4 Debian Jenkins Packages binary/ InRelease
Hit:5 Debian Jenkins Packages binary/ Release
Hit:6 Index of /ubuntu/ noble InRelease
Hit:8 Index of /ubuntu/ noble-updates InRelease
Get:9 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
Hit:10 https://ppa.launchpadcontent.net/ubuntu-toolchain-r/test/ubuntu noble InRelease
Hit:11 Index of /ubuntu/ noble-backports InRelease
Get:12 http://security.ubuntu.com/ubuntu noble-security/main amd64 c-n-f Metadata [3696 B]
Fetched 130 kB in 2s (67.2 kB/s)
Reading package lists… Done
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
apt-transport-https is already the newest version (2.7.14build2).
ca-certificates is already the newest version (20240203).
curl is already the newest version (8.5.0-2ubuntu10.2).
gnupg is already the newest version (2.4.4-2ubuntu17).
The following packages were automatically installed and are no longer required:
graphicsmagick libgraphicsmagick-q16-3t64 libhwy1t64 libjpeg9 libjxl0.7
Use ‘sudo apt autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Hit:1 https://deb.nodesource.com/node_18.x nodistro InRelease
Hit:2 https://repos-droplet.digitalocean.com/apt/droplet-agent main InRelease
Ign:3 Debian Jenkins Packages binary/ InRelease
Hit:4 https://repos.insights.digitalocean.com/apt/do-agent main InRelease
Hit:5 Debian Jenkins Packages binary/ Release
Hit:7 Index of /ubuntu/ noble InRelease
Hit:8 http://security.ubuntu.com/ubuntu noble-security InRelease
Hit:9 Index of /ubuntu/ noble-updates InRelease
Hit:10 https://ppa.launchpadcontent.net/ubuntu-toolchain-r/test/ubuntu noble InRelease
Hit:11 Index of /ubuntu/ noble-backports InRelease
Reading package lists… Done
2024-08-14 04:12:02 - Repository configured successfully.
2024-08-14 04:12:02 - To install Node.js, run: apt-get install nodejs -y
2024-08-14 04:12:02 - You can use N|solid Runtime as a node.js alternative
2024-08-14 04:12:02 - To install N|solid Runtime, run: apt-get install nsolid -y
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
nodejs is already the newest version (20.16.0-1nodesource1).
The following packages were automatically installed and are no longer required:
graphicsmagick libgraphicsmagick-q16-3t64 libhwy1t64 libjpeg9 libjxl0.7
Use ‘sudo apt autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
changed 19 packages in 3s
9 packages are looking for funding
run npm fund
for details
changed 1 package in 672ms
/dev/fd/63: line 80: 1~#!/usr/bin/env: No such file or directory
failed
- cd && git clone GitHub - discourse/discourse: A platform for community discussion. Free, open, simple. ~/discourse
- cd ~/discourse
- source ~/.bashrc
- bundle install || bundle install
Output
Post-install message from rubyzip:
RubyZip 3.0 is coming!
The public API of some Rubyzip classes has been modernized to use named
parameters for optional arguments. Please check your usage of the
following classes:
Zip::File
Zip::Entry
Zip::InputStream
Zip::OutputStream
Please ensure that your Gemfiles and .gemspecs are suitably restrictive
to avoid an unexpected breakage when 3.0 is released (e.g. ~> 2.3.0).
See GitHub - rubyzip/rubyzip: Official Rubyzip repository for details. The Changelog also
lists other enhancements and bugfixes that have been implemented since
version 2.3.0.
-
yarn install
Output
test@tworks:~/discourse$ yarn install
yarn install v1.22.22
[1/5] Validating package.json…
[2/5] Resolving packages…
warning Resolution field “unset-value@2.0.1” is incompatible with requested version “unset-value@^1.0.0”
success Already up-to-date.
$ ./app/assets/javascripts/run-patch-package && rm -rf app/assets/javascripts/node_modules
patch-package 8.0.0
Applying patches…
babel-plugin-debug-macros@0.3.4
content-tag@2.0.1
decorator-transforms@2.0.0
ember-this-fallback@0.4.0 (1 deprecation-name)
ember-this-fallback@0.4.0 (2 themes)
ember-this-fallback@0.4.0 (3 exclude-strict-mode)
virtual-dom@2.1.1
Done in 1.26s.
-
bin/rails db:create && bin/rails db:migrate && bin/rails db:migrate
-
bin/ember-cli -u
If any error
like
EACCES: permission denied, mkdir ‘/tmp/suhail/if-you-need-to-delete-this-open-an-issue-async-disk-cache/d828492962979ed87b104d6da2d66d89d2834137’
or
permission denied $TMPDIR/embroider/webpack-babel-loader/36ae93087b7f9608f2e88c4ce085f854eb311bb409533a5040262f329b132a02.json.gz
Then give full accesss to that path
sudo chmod -R 777 /tmp/suhail/if-you-need-to-delete-this-open-an-issue-async-disk-cache/
sudo chmod -R 777 /tmp/embroider/webpack-babel-loader
Discourse Ember CLI Proxy Error
FetchError: request to http://127.0.0.1:3000/ failed, reason: connect ECONNREFUSED 127.0.0.1:3000
at ClientRequest. (file:///home/test/discourse/app/assets/javascripts/custom-proxy/node_modules/node-fetch/src/index.js:108:11)
at ClientRequest.emit (node:events:519:28)
at Socket.socketErrorListener (node:_http_client:500:9)
at Socket.emit (node:events:519:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
“use strict”;
module.exports = function (environment) {
const ENV = {
modulePrefix: “discourse”,
environment,
rootURL: process.env.DISCOURSE_RELATIVE_URL_ROOT || “/”,
locationType: “history”,
historySupportMiddleware: false,
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
},
EXTEND_PROTOTYPES: {
// Prevent Ember Data from overriding Date.parse.
Date: false,
String: false,
},
},
exportApplicationGlobal: true,
APP: {
// Here you can pass flags/options to your application instance
// when it is created
},
};
if (process.env.EMBER_RAISE_ON_DEPRECATION === “1”) {
ENV.EmberENV.RAISE_ON_DEPRECATION = true;
} else if (process.env.EMBER_RAISE_ON_DEPRECATION === “0”) {
ENV.EmberENV.RAISE_ON_DEPRECATION = false;
} else {
// Default (normally false; true in core qunit runs)
}
if (environment === “development”) {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
}
if (environment === “test”) {
// Testem prefers this…
ENV.locationType = “none”;
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = "#ember-testing";
ENV.APP.autoboot = false;
}
if (environment === “production”) {
// here you can enable a production-specific feature
}
return ENV;
};
- if local : then go for
http://localhost:4200
if cloud then go for
http://cloudPublicIp:4200
example : http://139.59.13.239:4200/