- Download Linux version of Eclipse C++, copy to offline Ubuntu and extract. You can directly run eclipse without any further installation, but you need to finish the following steps to build a C++ project.
- On your Windows PC that is connected to the internet, install a virtualizer like VirtualBox and install Ubuntu Desktop 22.04 as virtual machine.
- Enable Windows - Ubuntu file sharing.
- Use the following shell script to download build_essentials on your online PCs Ubuntu virtual machine and its dependencies. You can copy these downloads to your offline Ubuntu and install them following the steps written as comments down below:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#1.On online Ubuntu 22.04, create a folder, save this script as download_build_essential.sh | |
#2.Make script executable with chmod +x download_build_essential.sh | |
#3.Run script with ./download_build_essential.sh | |
#4.Copy downladed .deb files (~76MB) to the offline Ubuntu 22.04 | |
#5.On offline Ubuntu, run sudo dpkg -i *.deb | |
#6.Verify installation with make --version | |
# Function to download a package and its dependencies | |
download_package() { | |
package=$1 | |
# Check if the package has already been processed | |
if grep -Fxq "$package" downloaded_packages.txt | |
then | |
echo "Already downloaded: $package" | |
return | |
else | |
echo "$package" >> downloaded_packages.txt | |
fi | |
echo "Downloading $package..." | |
apt-get download $package | |
for dep in $(apt-cache depends $package | grep Depends: | sed "s/ Depends://"); do | |
# Avoid downloading virtual packages | |
if apt-cache show $dep > /dev/null 2>&1; then | |
download_package $dep | |
fi | |
done | |
} | |
# Main package to download | |
main_package="build-essential" | |
# Update package lists | |
echo "Updating package lists..." | |
sudo apt-get update | |
# Create a directory for downloads | |
download_dir=$main_package | |
mkdir -p $download_dir | |
cd $download_dir | |
# File to keep track of downloaded packages | |
touch downloaded_packages.txt | |
# Download main package and dependencies | |
download_package $main_package | |
echo "Download completed. Files saved in $download_dir." |
No comments:
Post a Comment