Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I basically put down this question because I have an answer that does not (yet) have a question but I still want to share it (I don't have a blog space (yet))
So, the question is: How do I use Fedora with Windows 10 WSL (Anniversary update) in stead of Ubuntu?
This answer assumes a minimal understanding of Linux (Fedora) and a basic understanding of using the windows Run command dialog (opened via the WIN-R key combination)
My starting point was this article by Seth Jennings: https://www.variantweb.net/blog/running-fedora-on-windows-10-using-wsl/
However, I ran into some challenges that were related to symlinks and started playing around. Which resulted in the description you can find below.
I think it should not be very hard to adapt these steps to use other flavors of Linux but you will have to experiment with those. If you do have a successful installation, please let us know in the comments, including any deviations required.
I start with a clean Ubuntu installation. I anything goes wrong, you can always restart with reinstalling Ubuntu
Installing a fresh instance of Ubuntu
Press WIN-R and type cmd
lxrun /uninstall /full /y
lxrun /install /y
Select a username you want to use and replace USERNAME below with that name
lxrun /setdefaultuser USERNAME
Enter user password
Download the Fedora Docker image
open a browser to http://koji.fedoraproject.org/koji/tasks?owner=&state=closed&view=flat&method=createImage&order=-id
Select the docker image you want to use
download the file Fedora-Docker-Base-??? from the Output section
for ease sake, I will assume the file is downloaded to c:\temp and that you will be using Fedora 24
Prepare Fedora in the Ubuntu instance
Press WIN-R and type bash
sudo -i
passwd root
Enter root password twice
usermod -G wheel USERNAME # Replace USERNAME with the name you used in the lxrun command above
If you choose a different version than Fedora 24, you might want to change f24 below accordingly
mkdir /f24
cd /f24
tar Jxvf /mnt/c/temp/Fedora-Docker-Base???
a directory with a hash name will be created, I will call it $DIR
tar xvf $DIR/layer.tar
for f in bin etc lib lib64 sbin usr var; do mv $f ../$f.f24; done
cd /
cp /etc/{passwd,group,shadow,sudoers} /etc.f24
edit /etc.f24/sudoers
Disable the line that starts with %sudo
Add the following line:
%wheel ALL=(ALL:ALL) NOPASSWD: ALL # The NOPASSWD is absolutely needed or sudo will not work
exit
exit
Replace Ubuntu with Fedora
Open your favorite Windows file explorer to %LOCALAPPDATA%\lxss\rootfs
Add suffix .ubuntu to the directories: bin etc lib lib64 sbin usr var
Rename the files and directories that end in .f24 to remove the suffix .f24
If you ever want to move back to Ubuntu, simply revers these steps (rename the directories and symlinks to add the .f24 suffix and remove the .ubuntu suffix (IN THAT ORDER)) Or you can simply reinstall the Ubuntu instance
Run update and install sudo and openssh clients
Press WIN-R and type bash
su -
Enter root password you set above
dnf update -y
dnf install -y sudo openssh-clients
exit
exit
Cleanup
Either via a Windows file explorer (%LOCALAPPDATA%\lxss\rootfs) or through the bash instance (cd /), remove the directories f24 and *.ubuntu
Et voila Fedora 24 on your Windows 10 system
Many tools are not installed so you have to install them manually (openssh, tar, find, and many more)
If you want to run graphical stuff you will need an X server, Cygwin/X or VcXsrv (very small) are good tools to use
And a final after thought: You could replace %LOCALAPPDATA%\lxss\bash.ico with a nice Fedora logo to replace the Ubuntu logo, just keep the filename the same.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
How do I stop MacOS updates from overwriting my auto_master file?
Every non-trivial MacOS update always removes my custom auto_master and puts in the default auto_master. I actually only add a single line to the end of the file and do not even modify the existing lines because they are irrelevant for me.
I have spent quite a bit of time figuring out automounts of NFS shares in OS X...
Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible:
/etc/auto_master (see last line):
#
# Automounter master map
#
+auto_master # Use directory service
/net -hosts -nobrowse,hidefromfinder,nosuid
/home auto_home -nobrowse,hidefromfinder
/Network/Servers -fstab
/- -static
/- auto_nfs -nobrowse,nosuid
/etc/auto_nfs (this is all one line):
/Volumes/my_mount -fstype=nfs,noowners,nolockd,noresvport,hard,bg,intr,rw,tcp,nfc nfs://192.168.1.1:/exports/my_share
Make sure you:
sudo chmod 644 /etc/auto_nfs
Otherwise the automounter will not be able to read the config and fail with a ... parse_entry: getmapent for map failed... error in /var/log/messages
This will not work (anymore!) though it "should".
$ sudo automount -cv
...
automount: /Volumes/my_mount: mountpoint unavailable
Note that, if you manually create the mount point using mkdir, it will mount.
But, upon restart, OS X removes the mount point, and automounting will fail.
What's the solution?
It's so easy my jaw dropped when I figured it out.
Basically, we are tricking OS X into thinking we're mounting somewhere else.
When you're talking about paths in just about any environment, the root folder is the highest path you can reach, whether it's C:\ (windows) or / (*nix)
When you're at this path, attempting to reach the parent path, via .. will keep you at the root path.
For example: /../../../../ is still just /
By now, a few of you have already figured it out.
TL;DR / Solution:
Change your /etc/auto_nfs config from (this is all one line):
/Volumes/my_mount -fstype=nfs,noowners,nolockd,noresvport,hard,bg,intr,rw,tcp,nfc nfs://192.168.1.1:/exports/my_share
For pre-Catalina: To (this is all one line)
/../Volumes/my_mount -fstype=nfs,noowners,nolockd,noresvport,hard,bg,intr,rw,tcp,nfc nfs://192.168.1.1:/exports/my_share
For Catalina and up: To (this is all one line)
/System/Volumes/Data/../Data/Volumes/my_mount -fstype=nfs,noowners,nolockd,noresvport,hard,bg,intr,rw,tcp,nfc nfs://192.168.1.1:/exports/my_share
And re-run the automounter:
$ sudo automount -cv
...
automount: /Volumes/my_mount: mounted
..... there you go! Technically /../Volumes is still /Volumes, but the automounter does not see things that way ;)
This configuration persists the mount across restarts, and creates the mountpoint automatically.
Source github : https://gist.github.com/L422Y/8697518
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
How can I change the default directory of windows bash to a folder of my choosing?
EDIT: I guess I should have been more clear. When I startup Bash I want it the directory to be in a location of my choosing like Desktop or something. How do I go about setting a default directory?
If you want change the directory your bash prompt is starting in, you can edit your .bashrc file. At the bottom, add:
cd ~
This will go into your home directory. (you can actually do just cd, but I it's clearer to add the ~ IMO)
To edit, you can use vim. If you don't know how to use it, you can always use nano for the time being, but you really should have a look at it, it's really powerful.
$ nano ~/.bashrc
This will open nano in "full console". At the bottom, you have the few commands you can use (^ means control) Do your changes, hit ctrl+o to save the file (write the file). It'll ask you where to write, by default, it's the right location, just hit enter and the .bashrc file will be saved. Then, you can press ctrl+x to exit.
Steps to set default directory for Bash on Ubuntu on Windows to a folder -
Open Bash on Ubuntu on Windows.
cd ~ to go to home directory of Ubuntu
Type edit .bashrc and enter at the Bash. This will open the file in vim.
Use Down Arrow or Page Down key on keyboard to go to the end of the file (there's a helpful progress bar at the bottom right corner of the Bash). At the end of this file, you will find cd ~, replace cd ~ with your desired location.
Save the .bashrc file. To save the file, click esc and then type :wq and click enter.
Note:
To access your hard disk location make sure you include the mount directory first.
So if want your Bash to open at C:\dev whenever you open the Bash. You need to replace the cd ~ with cd /mnt/c/dev at .bashrc file at Ubuntu home directory.
Just enter echo "cd ~" >> ~/.bashrc. This will append "cd ~" to your .bashrc.
.bashrc is executed everytime you start a(n interactive) bash instance.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I'm new to using mac. Could someone please help me out with the terminal commands?
cd to jump into folders right?
i tried this but it isn't working for a folder in my desktop.
Basically, I want to enter a folder on my dekstop and then go to another folder inside that. how do i do it?
The Terminal starts in your HOME folder normally. So, type
ls
to list the files and you will see the same folders and files you see when you go to HOME in the Finder. So, you will see Desktop, so now type
cd Desktop
ls
and you will see all the folders and files on your desktop. If you want to go into one called Freddy Frog now, you will need to put double quotes around it to make sure the space between Freddy and Frog is kept and it doesn't think you want to go to a folder called Freddy then one called Frog. so type
cd "Freddy Frog"
ls
and you can now go to the "Spiders from Mars" directory in there with
cd "Spiders from Mars"
ls
In general, you can just start typing the name of the folder you mean and press TAB and it will guess what you mean. So, if you start a new Terminal and type:
ls
you will see the files in your Home directory. Now type:
cd Desk<TAB>
and it will show you what it guesses you mean. That's called filename completion. If you want to know where you are currently located, use:
pwd
which will print the working directory.
If you want to return to your HOME directory at any time, just type:
cd
Two other tips for you if you are learning your way around...
Firstly, if you want Finder to open and display the directory you are currently in in the Terminal, you can run:
open .
Secondly, when Finder opens, you can turn on the Path bar at the bottom of the window by typing:
Command+Option+P
I have shown it in red - no idea why Apple ships with it turned off by default - probably explains why most Mac users I have met generally have no idea where their files are and don't know the difference between copying and moving files!
To change directory to say /usr , the command should be cd /usr
i.e. cd followed by the absolute path of the directory. For relative paths use cd ./usr where the directory usr is in your current directory.This link gives complete documentation of cd command.
Use the change directory command:
using relative paths cd ./relative/path/to/directory
using absolute paths cd /absolute/path/to/directory
IMPORTANT: do not to forget the space after cd and before the path!!!!!
On Windows, the space isn't needed for some reason...
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 11 months ago.
The community reviewed whether to reopen this question 11 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I am trying to run the command CP at the command prompt on Windows 7 but I'm getting:
'cp' is not recognized as an internal or external command, operable program or batch file.
Do I need to install any software to run "cp" command?
If so what?
By default, there's no cp in Windows Command Prompt (cmd.exe). The equivalent cmd.exe command is copy. cp is a Unix command.
If you can use PowerShell instead, which should come pre-installed in modern Windows systems, you can use cp and some other Unix commands directly in it.
If PowerShell isn't an alternative, you can use cp directly in Windows Command Prompt if you install Cygwin.
Moreover, Cygwin also includes the rsync command, which has many more features than cp, and might be preferable if you're not just copying a single file (e.g. for backup purposes).
it is a unix/linux command. Download the cygwin package from cygwin.com
There's a way to do run cp without cygwin and powershell and without admin rights.
Download the respective package (CoreUtils) from the Gnu-Win32 package repository.
You need the zipped binaries and the zipped dependencies.
Unpack, and copy bin from deps to bin from coreutils.
Now add the bin folder to the path environment variable (system or user, depending on if you're admin or not), and open a new console. Type cp, and you'll see standard cp command output.
use cp of git , is good !
download here : https://git-scm.com/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
The default install directory of apt-get is /opt.
Can I change it to another directory?
Best way I can think of is to use a symbolic link
note that not all programmes are installed to the same directory and /opt may not be the best thing to move. (see end for example of moving only one folder/program)
This is what I did with EasyPeasy (Ubuntu 10.04)
Follow this code carefully some of the commands can delete important files if used incorrectly.
First you need to make sure /opt (or your distros default apt-get install directory) is empty. If you have data in the opt folder, which you most likely do, you can move it to somewhere else first for safe keeping:
sudo mkdir /New_Location/newtmp # Generates Temporary Folder for Programs
sudo cp -a /opt/* /New_Location/newtmp # Moves Programs to Temp folder
Once backed up you can remove the original directory:
sudo rm -rf /opt/ # Removes opt directory
You can then create your new Program Files folder in a drive with lots of space and create a symbolic link:
sudo mkdir /New_Location/Program-Files # Generates New Program Directory
sudo ln -s /New_Location/Program-Files /opt # Creates Symbolic Link
Finally move all your old program files to your new folder and clean up the temporary data:
sudo cp -a /New_Location/newtmp/* /New_Location/Program-Files # Moves Programs to Program Files Folder
sudo rm -rf /New_Location/newtmp/ # Removes Temp folder
If you only wanted to move a single program which is taking up a hunk of your space you could use the same process.
eg:
to move Java (JVM approx 300MB) do the following.
check directory of java using disk usage analyser.
mine is /usr/lib/jvm
sudo mkdir /New_Location/Program-Files/Java # Generates New Program Directory
sudo cp -a /usr/lib/jvm/* /New_Location/Program-Files/Java # Moves Program to new folder
sudo rm -rf /usr/lib/jvm # Removes opt directory
sudo ln -s /New_Location/Program-Files/Java /usr/lib/jvm # Creates Symbolic Link
Its best at this point to do a restart which should clear the cache.
You can't: the installation path is hard-coded in packages (see for example: http://packages.ubuntu.com/oneiric/i386/mono-runtime/filelist). This path is usually /usr instead of /opt, but it depends of the packages. If you want to override the default directory, you must extract manually the content of the packages. But, it can not work: config files, even binary files sometimes, will continue to use the old path. So you must update them in order for the packages to work correctly.