Where and how to create symlink from public/storage to storage/app/public in laravel 5.2 on homestead on window - angularjs

how to create symlink from public/storage to storage/app/public in homestead on window.
and how do i access my files from browser, so if i visit that image url via browser then it will show that particular image.
actually i'm building an api which accessible from any domain , so i have to return the url of that particular image which is uploaded. so it will be shown of front end.
i'm also saving path to database which is - storage/app/public/image.png . what should i do now..
I'm new to file system so may be i need steps by step instruction.
i will be so thankful for the help

I had the same problem creating a symbolic link from the "public" folder to a location on the "storage" directory.
I tried to use "mklink /j" as well to create the symlink. However, when I "vagrant ssh" to the virtualbox, I found that it did not actually create the link correctly. Attempting to "cd" to the created link would cause an error. Also it wasn't shown as a symlink in the usual linux notation.
To allow the symlink to be created in the virtualBox:
Open "Local Group Policy Editor".
Go to: Computer Configuration | Windows Settings | Security Settings | Local -Policies | User Rights Assignment
Find the "Create symbolic links" policy and add your logged in user to it.
Restart your host windows machine. ssh to your virtualbox. You may need to run "vagrant up" as an Administrator by opening your CMD using "Run as administrator" option.
Go to your "public" folder, and create your symbolic link using the linux "ln -s" command. It should work now.
I was using Windows 10, but the above should be the same for Windows 7.
The "Create symbolic links" policy may be located somewhere slightly different for earlier versions of Windows.
Credit should go to this blog: Symlink support in Windows and Virtualbox

I tried this and it works. Running homestead on VirtualBox on Windows 10:
Open cmd as administrator
Click Start->Run
Type 'cmd', and press ctrl-shift-enter
Select 'yes' from the pop-up window
Type the following command:mklink /D c:\<project_directory>\public\storage "/home/vagrant/<project_directory>/storage/app"
Then the storage/app will be accessible from public/storage in Homestead VM. Note that this is assuming C:\ is shared as /home/vagrant in Homestead VM.

On a MacOS you need to go to your Homestead folder and:
run: vagrant ssh
navigate to your project root folder
run: php artisan storage:link
And you are done.
If you do this without ssh to vagrant then it will not work.

Related

How to get vscode-remote-ssh extension connects via git bash in windows?

I have vs code configured to use the git bash as a terminal in windows 7.
"terminal.integrated.shell.windows": "C:\Program Files\Git\bin\bash.exe"
I have enabled SSH key based authentication to remotely access a host. All this works fine from within the terminal in VS Code.
However, when using the vscode-remote SSH extension to connect to host I get an error because it tries to connect using "The terminal process command 'cmd.exe'" instead of git bash.
I've checked my terminal settings configuration in vs code and it points to git bash.exe
I've used the terminal extension in vs code and it opens a git bash and successfully connects to the host
Is there a setting that I'm missing to force Remote-SSH to use the git bash for the connection?
JerryL's answer lead me to realize, that I can simply set GIT's ssh path c:\Program Files\Git\usr\bin\ssh.exe in the remote.SSH.path setting of VS Code Preferences:
Then it just worked like a charm.
Just for clarity my VS Code version is: 1.40.0-insider (system setup)
I ran into a similar issue trying to get MS VS Code Studio Remote-SSH working with Putty's Pageant. I had Git for Windows installed and in a Git Bash shell, I could ssh and pick up the Pageant keys and no password was needed.
But VS Code Remote-SSH, while using the Git ssh in C:\Program Files\Git\usr\bin\ssh.exe was using Windows 7 cmd.exe shell which didn't talk to Pageant.
What worked for me on Windows 7, VS Code 1.36.1 with (Remote Development 0.15.0, Remote-SSH 0.44.0) and Git for Windows 2.22:
Start Pageant (C:\Program Files\PuTTY\pageant.exe) and Add key.
Start the ssh agent shim (C:\Program Files\Git\cmd\start-ssh-pageant.cmd). This takes care of the communication between Git ssh, which looks for ssh-agent, and Pageant.
Create the SSH_AUTH_SOCK environment variable
Control Panel / System / Advanced Settings / Environment Variables..
User variables for username / New..:
Variable name: SSH_AUTH_SOCK
Variable value: /tmp/.ssh-pageant-username (e.g. /tmp/.ssh-pageant-bill) (Environment Variable assignment screenshot)
Test ssh:
Open a command prompt: Enter set to view the list of Environment Variables. Is the SSH_AUTH_SOCK variable set correctly to something like /tmp/.ssh-pageant-bill?
Try ssh to your host using Git's ssh.exe: c:\Program Files\Git\usr\bin\ssh.exe user#host If this works, then VS Code Remote-SSH should work.
Finally, I added Pageant and start-ssh-pageant.cmd to my Windows 7 Startup so this persists across reboots.
Hope that helps.
Jerry.
I had a similar problem trying to get VS Code Remote use Putty Pageant.
1. Create .bat file somewhere with the following content:
echo OpenSSH
"C:\YOUR_PATH_HERE\PLINK.EXE" -ssh %*
2. Open VS Code settings, type remote ssh path in search and find Remote.SSH: Path settings
3. Past here path to your .bat file
4. Now VS Code Remote will use Pageant correctly.

How do i resolve "Failed to parse remote port from server"

I'm setting up a new remote host and every time i initiate it i get the following error output: Any feedback or direction on how to resolve this issue?
Pseudo-terminal will not be allocated because stdin is not a terminal.
Linux Destiny 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1 (2019-04-12) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
mesg: ttyname failed: Inappropriate ioctl for device
bash: cannot set terminal process group (3202): Inappropriate ioctl for device
bash: no job control in this shell
mesg: ttyname failed: Inappropriate ioctl for device
Installing...
Downloading with wget
WARNING: tar exited with non-0 exit code
Found running server...
*
* Reminder: You may only use this software with Visual Studio family products,
* as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057)
*
cat: /root/.vscode-remote/.473af338e1bd9ad4d9853933da1cd9d5d9e07dc9.log: No such
file or directory
Server did not start successfully. Full server log:
cat: /root/.vscode-remote/.X.log51ec4692-
4da4-4ec0-b613-5a3563034cf1====
: No such file or directory
"install" terminal command done
Received install output: : No such file or directory
Failed to parse remote port from server output: : No such file or directory
If the server fails to shut down properly, sometimes it leaves dangling lockfiles. This can cause startup to fail and produce the "Failed to parse remote port from server output" error message. In this case the solution is to simply to delete the lockfiles:
.vscode-server/bin/[:xdigit:]*/vscode-remote-lock.*
Fixed the issue. It appears I had 2 other server agents running incorrectly. I killed both server agents using kill (PID) and removed ".vscode_remote" directory from user home directory. Then i reinitialized remote-ssh from vscode. Successfully connected!
On remote machine you do not have a tar installed. It's in log output
Installing... Downloading with wget
WARNING: tar exited with non-0 exit code
so under a root run:
apt-get install tar
or with sudo, if you have a user with sudoers configured:
sudo apt-get install tar
I also got the same issue and my workaround was to provide proper rights to the home or user folder, so vscode can create a remote folder and do the required installation on it.
Example :
sudo chmod -R 777 home/
In this case, I have provided all rights to my home folder and It worked like a charm for all the users.
I ssh'd onto the remote server (linux) and then deleted both directories as follows:
$ rm -r .vscode-server.backup2022-04-03T16:20:18-05:00
$ rm -r .vscode-server
In case someone else encounters the same issue - I had an instance where remote target had no space left on device. After extending root volume of target machine, connection worked fine.
I had the same issue because vscode was looking for my .vscode-server directory in the wrong location (it was in a custom location due to restrictions on where files can be saved). This can be fixed by using How to change vscode-server directory. Specifically add:
"remote.SSH.lockfilesInTmp": true,
"remote.SSH.serverInstallPath":{
"hostname":"/path/to/.vscode-server/.."
}
To your settings.json
In my case, it wasn't working because of server asking for new password when starting a session. What I did was to open a new default terminal (not VSC terminal but your OS default terminal like ZSH, CMD, and so on). And I used the ssh command to login. I logged in successfully and changed the password. Then I tried connecting with the new password and it worked because the server didn't asked for password change now.
Command:
ssh username#IP
Enter password and you'll get asked to change the password. Change the password and try connecting again with new password using SSH VSC extension.
If yout authorize by ssh-key - also check the value of User parameter in VsCode ssh config. User must have matching key in ~/.ssh/authorized_keys on remote host.
#Sachin's answer directed me in the right direction, VSCode needs permissions in order to create some files, but instead of giving 777 permissions to your home folder (which can be dangerous) you can just chown the user that wants to log in (the user for me was ubuntu):
sudo chown -R ubuntu /home
I also got the same issue and my workaround was to provide proper rights to the home or user folder, so vscode can create a remote folder and do the required installation on it.
Step 1: Add port to your config file :
Host hostname
Port 22
User username
Step 2 : Go to File->Prefrences ->Open settings.json fle
Search for lockfilesInTmp
and check the box next to that

Running batch file from network share (vmware shared folder) in cygwin

I'm having some problems with cygwin and a mapped network drive. My setup is kind of convoluted to deal with some limitations with our corporate VPN. I'm running a Windows 10 VM under VMware Fusion with a shared folder from my Mac host which is mapped to a network drive in Windows. The reason is b/c I access a remote Git repo using a VPN connection that leverages a browser plugin that unfortunately is only working from Safari currently. I need to run git commands from the Mac host but the project's build/development environment is Windows. The VPN browser plugin fails to install in any of the browsers under Windows. Hopefully a temporary problem but one I must workaround for now.
From my cygwin environment the mapped drive does not show up under /cygdrive, possibly b/c it's a shared folder with hgfs file system type. I'm able to mount the shared folder but when I try to run a batch file from the cygwin environment I get the following error:
./OpenCommandPrompt.bat
'\\vmware-host\Shared Folders\grant\Projects\lts\Product'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
The system cannot find the path specified.
'setenv.bat' is not recognized as an internal or external command,
operable program or batch file.
'setclasspath.bat' is not recognized as an internal or external
command, operable program or batch file.
C:\Windows>
It doesn't like the UNC path. I'm able to run the command fine from a PowerShell using the mapped drive letter but no luck from cygwin. My desire is to run the VM headless and access the Windows environment over SSH from my host so I'd like to get this working from the cygwin environment if possible. Any suggestions?
I was able to fix my issue by creating a simple script that I execute from my .bash_profile. I basically check for existence of the /cygdrive/h folder and if it doesn't exist I execute the script.
#!/bin/bash
net use H: '\\vmware-host\Shared Folders\share'
I tried to map the drive from Windows but all attempts to do so failed to register the drive mapping under the /cygdrive folder in cygwin. That was the issue I was trying to overcome. Once I had the mapped drive under /cygdrive, I was able to execute all the batch scripts.
To be honest, I'm still not sure why mapping the drive from Windows does not register it cygwin. The reverse is also true: if I execute the net command from the terminal, it does not register in Explorer.

how to install check_inode plugin in nagios

i have to install a plugin on a red hat server where nagios is already configured.
the plugin to be installed is inode_checker which i got from this link
how to install inode checker in nagios
but when i opened this link i could find a shell script here.
now i am not sure whether i have to place the shell script directly on the server in the location /usr/local/nagios/libexec/ or is there any other way to do it since the other plugins available in this location seems to be different and i am not able to open them.
what am i doing wrong here?please advise.
Yes, this is a bash script so simply download and place it in the folder where you have other scripts sitting. Make sure to make it executable like
chmod +x scriptname
Then you should be able to use it in nagios by creating a Command object. You can find the location of the folder where your scripts are located by looking at the resources.cfg file which should hold something like below:
$USER1$=/usr/lib64/nagios/plugins
Hope this helps.

Change document root in ubuntu 12.04

I have tried every possible solution to change the document root on ubuntu to my new site but nothing works. I have changed the setting in available sites default file (both document root and directory root) to my new directory housing the website or creating a new available sites file pointing to my web directory and switching the site through a2ensite and a2dissite commands. But still it goes to the same default page
I already fixed that :
Install webmin
From webmin goto servers->Apache webserver
Edit the default "virtual host" :
handle all connections
add your doc-root
use httpd.conf file ..
Once done do a server restart from webmin or the command line:
sudo /etc/init.d/apache2 restart

Resources