Pass arguments to the PowerShell script in PowerShell ISE

Use the command pane. Open the script file in the ISE editor, set the breakpoints (F9). Then in the command pane type a command invoking this script with required parameters. I do not think there is another (built-in) way of doing this in ISE.

Advertisements
Posted in develop | Tagged , , | Leave a comment

Add a repository to SEL

Reference https://code.visualstudio.com/docs/setup/linux

Running VS Code on Linux
Installation

openSUSE and SLE based distributions

The yum repository above also works for openSUSE and SLE based systems, the following script will install the key and repository:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/zypp/repos.d/vscode.repo'

Then update the package cache and install the package using:

sudo zypper refresh
sudo zypper install code

Run Visual code as tony user.

whereis code
# code: /usr/bin/code /usr/share/code /usr/share/man/mann/code.n.gz
code

Read more from https://code.visualstudio.com/docs?start=true

==================

 

Reference:
https://tecadmin.net/install-visual-studio-code-editor-in-suse-linux/

Step #1. Enable Package Repository

Create a new file /etc/zypp/repos.d/vscode.repo and edit in text editor. Now add following content to the file.

[vscode]
name=Visual Studio Code
baseurl=https://packages.microsoft.com/yumrepos/vscode
enabled=1
type=rpm-md
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc

Step #2. Install Visual Studio Code

Now, Import the package signing gpg key on your system using the following command.

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

After importing gpg key, let’s use below commands to install Visual Code on your openSUSE or SEL system.

tony@linux-31cz:~/SqlToolsService>

sudo zypper refresh

 #Repository 'SDK12-SP2 12.2-0' is up to date.
 #Repository 'SLES12-SP2-12.2-0' is up to date.
 #Repository 'ibm_sles12sp2' is up to date.
 #Repository 'packages-microsoft-com-mssql-server-2017' is up to date.
 #Repository 'packages-microsoft-com-prod' is up to date.
 #Repository 'Visual Studio Code' is up to date.
 #All repositories have been refreshed.
sudo zypper install code
 Loading repository data...
 Reading installed packages...
 Resolving package dependencies...

The following NEW package is going to be installed:
 code

The following package has no support information from it's vendor:
 code

1 new package to install.
 Overall download size: 65.1 MiB. Already cached: 0 B. After the operation, additional 191.9 MiB will be used.
 Continue? [y/n/...? shows all options] (y): y
 Retrieving package code-1.19.3-1516876593.el7.x86_64 (1/1), 65.1 MiB (191.9 MiB unpacked)
 Retrieving: code-1.19.3-1516876593.el7.x86_64.rpm ............................................................[error]
 Download (curl) error for 'https://packages.microsoft.com/yumrepos/vscode/code-1.19.3-1516876593.el7.x86_64.rpm':
 Error code: Connection failed
 Error message: Failed to connect to packages.microsoft.com port 443: Connection refused

Abort, retry, ignore? [a/r/i/...? shows all options] (a): r
 Abort, retry, ignore? [a/r/i/...? shows all options] (a): r
 Retrieving: code-1.19.3-1516876593.el7.x86_64.rpm ............................................................[error]
 Download (curl) error for 'https://packages.microsoft.com/yumrepos/vscode/code-1.19.3-1516876593.el7.x86_64.rpm':
 Error code: Connection failed
 Error message: Failed to connect to packages.microsoft.com port 443: Connection refused

Abort, retry, ignore? [a/r/i/...? shows all options] (a): r
 Abort, retry, ignore? [a/r/i/...? shows all options] (a): r
 Retrieving: code-1.19.3-1516876593.el7.x86_64.rpm ---------------------------------------------------------[starting]Retrieving: code-1.19.3-1516876593.el7.x86_64.rpm ............................................................[error]
 Download (curl) error for 'https://packages.microsoft.com/yumrepos/vscode/code-1.19.3-1516876593.el7.x86_64.rpm':
 Error code: Connection failed
 Error message: Failed to connect to packages.microsoft.com port 443: Connection refused

Abort, retry, ignore? [a/r/i/...? shows all options] (a): r
 Invalid answer 'rr'. [a/r/i/...? shows all options] (a): r
 Abort, retry, ignore? [a/r/i/...? shows all options] (a): r
 Retrieving: code-1.19.3-1516876593.el7.x86_64.rpm .................................................[done (3.6 MiB/s)]
 Checking for file conflicts: ..................................................................................[done]
 (1/1) Installing: code-1.19.3-1516876593.el7.x86_64 ...........................................................[done]
 tony@linux-31cz:~/SqlToolsService>

 

Step #3. Open Visual Studio Code

Now launch the Visual Studio Code editor on your system using graphical menu. After that create new file or open files and directories using File menu.

Step #4. Add Required Extensions

There are a large number of extensions available for Visual Studio Code like, C#, Python, JavaScript, Google Chrome etc. Install the required extensions to enhance your working experience with Visual Studio Code.

======================================================================

Update sql server, sql tools and unixODBC packages on Linux

sudo zypper update mssql-server mssql-tools unixODBC-devel

========= BELOW IT IS THE OUTPUT =====================================

tony@linux-31cz:~/SqlToolsService> sudo zypper update mssql-server
root's password:
Loading repository data...
Reading installed packages...
No update candidate for 'mssql-server-14.0.3015.40-1.x86_64'. The highest available version is already installed.
Resolving package dependencies...

Nothing to do.
tony@linux-31cz:~/SqlToolsService>

tony@linux-31cz:~/SqlToolsService> sudo zypper update mssql-tools unixODBC-devel
Download (curl) error for 'https://packages.microsoft.com/sles/12/mssql-server-2017/repodata/repomd.xml':
Error code: Connection failed
Error message: Failed to connect to packages.microsoft.com port 443: Connection refused

Abort, retry, ignore? [a/r/i/...? shows all options] (a): r
Abort, retry, ignore? [a/r/i/...? shows all options] (a): r
Download (curl) error for 'https://packages.microsoft.com/sles/12/mssql-server-2017/repodata/repomd.xml':
Error code: Connection failed
Error message: Failed to connect to packages.microsoft.com port 443: Connection refused

Abort, retry, ignore? [a/r/i/...? shows all options] (a): r
Abort, retry, ignore? [a/r/i/...? shows all options] (a): r
Download (curl) error for 'https://packages.microsoft.com/sles/12/mssql-server-2017/repodata/repomd.xml':
Error code: Connection failed
Error message: Failed to connect to packages.microsoft.com port 443: Connection refused

Abort, retry, ignore? [a/r/i/...? shows all options] (a): r
Abort, retry, ignore? [a/r/i/...? shows all options] (a): r
Loading repository data...
Reading installed packages...
No update candidate for 'unixODBC-devel-2.3.4-6.5.x86_64'. The highest available version is already installed.
No update candidate for 'mssql-tools-14.0.6.0-1.x86_64'. The highest available version is already installed.
Resolving package dependencies...

Nothing to do.
tony@linux-31cz:~/SqlToolsService>

Posted in develop, linux | Tagged , , , | Leave a comment

VDI Client on Linux

Prerequisites for building the VDI client

Download SLES release of llvm + clang from http://releases.llvm.org/

tar -xvf clang+llvm-5.0.1-linux-x86_64-sles12.2.tar.xz

Install libuuid-devel from SDK or Suse repo.

export PATH=/home/tony/clang+llvm-5.0.1-linux-x86_64-sles12.2/bin/:$PATH

cd /home/tony/sandbox/tsm/sqlvdi-linux

LD_LIBRARY_PATH=”/opt/mssql/lib” make -f Makefile

 

Run vdisample

https://github.com/Microsoft/sql-server-samples/tree/master/samples/features/sqlvdi-linux

https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-backup-vdi-specification

 

  • Run the vdi client as the mssql user or follow these instructions:
    • Add the user running the vdi client to mssql group
    • sudo usermod -a -G mssql vdiuser
    • Add the mssql user to the vdi client user’s group
    • sudo usermod -a -G vdiuser mssql
    • Reboot

 

Run the following command to issue a database backup of pubs:

LD_LIBRARY_PATH=”/opt/mssql/lib” ./vdipipesample B D pubs sa <SQLSAPASSWORD> /tmp/pubs.bak

In PS add root to mssql

sudo usermod -a -G mssql root

remote as root and then run:

$command = ‘LD_LIBRARY_PATH=”/opt/mssql/lib” /home/tony/sandbox/tsm/sqlvdi-linux/vdipipesample B D TestDB sa passw0rD! /tmp/testdb_0206.bak’
exec $command

 

 

Delete a user from group

sudo gpasswd -d mssql omiusers
Removing user mssql from group omiusers
groups mssql
mssql : mssql

 

To start omiserver use -d, to stop use -s

sudo bash

cd /opt/omi/bin

omiserver -s

omiserver -d

Posted in linux, sql.server | Tagged , , | Leave a comment

gnome-commander from OpenSuse

Get the one click install from

https://software.opensuse.org/download.html?project=openSUSE%3AFactory&package=gnome-commander

The one click install is https://software.opensuse.org/ymp/openSUSE:Factory/standard/gnome-commander.ymp

Open it in nautilus or File Manager by doubleclick

https://gcmd.github.io/index.html

https://168hours.wordpress.com/2008/08/18/10-total-commander-alternatives-for-linux/

SUSE package hub

https://packagehub.suse.com/how-to-use/post-installation/

Posted in linux | Tagged , | Leave a comment

Mount Shared Drive on VirtualBox Linux

Inside Suse edit the Suse’s rc.local file which is:

sudo vi /etc/init.d/after.local

to automatically mount the shared folder every time the Linux starts:

sudo mount -t vboxsf D_DRIVE /mnt

Restart the OS.

In order to have access to the FS and sync source files directory use Samba.

Configure Samba server to sync the directories and start the Samba Server:

rcnmb start && rcsmb start

Reference

https://askubuntu.com/questions/252853/how-to-mount-a-virtualbox-shared-folder-at-startup

Commander Tools on Gnome

You need a file manager for dir sync. For example,

https://krusader.org/get-krusader/index.html

Gnome commander

Starting Nautilus failed with

tony@linux-31cz:~> sudo nautilus
root's password:
Unable to init server: Could not connect: Connection refused

(nautilus:8426): Gtk-WARNING **: cannot open display:

Start using nautilus or by running:

gnomesu nautilus

sudo -E nautilus

gnomesu gedit /etc/sysctl.conf

https://www.linuxquestions.org/questions/linux-software-2/issue-with-running-sudo-synaptic-4175615919/

Posted in linux | Tagged | Leave a comment

Resize VMDK disk of a SUSE Linux VM

Run in a Command Prompt. Pay attention to the disk UUID.

pushd C:\Program Files\Oracle\VirtualBox

VBoxManage.exe clonemedium D:\VirtualBoxVMs\SQLONSLES\SQLONSLES.vmdk D:\VirtualBoxVMs\SQLONSLES\SQLONSLES.vdi --format VDI
@REM 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
@REM Clone medium created in format 'VDI'. UUID: e84ba0f2-37f9-43c1-9dcb-3cb3bbcce991

VBoxManage modifymedium disk D:\VirtualBoxVMs\SQLONSLES\SQLONSLES.vdi --resize 15360
@REM 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

VBoxManage.exe clonemedium disk D:\VirtualBoxVMs\SQLONSLES\SQLONSLES.vdi D:\VirtualBoxVMs\SQLONSLES\SQLONSLES_15GB.vmdk --format VMDK
@REM 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
@REM Clone medium created in format 'VMDK'. UUID: 28c39f72-9572-4eda-a485-0325fac79c0c

VBoxManage.exe showmediuminfo D:\VirtualBoxVMs\SQLONSLES\SQLONSLES_15GB.vmdk
UUID:           28c39f72-9572-4eda-a485-0325fac79c0c
Parent UUID:    base
State:          locked write
Type:           normal (base)
Location:       D:\VirtualBoxVMs\SQLONSLES\SQLONSLES_15GB.vmdk
Storage format: VMDK
Format variant: dynamic default
Capacity:       15360 MBytes
Size on disk:   6359 MBytes
Encryption:     disabled
In use by VMs:  SQLONSLES (UUID: 6bf2b4ff-828e-4536-98ba-9cb388e5ee66)

popd

Open the VirtualBox and drop the old vmdk and add the new enlarged vmdk.

Then add the ISO for the SUSE to boot the Linux VM from it. And select to recover. Run the following commands to resize the sda2 partition, and then resize the brtfs partition:

parted /dev/sda

resize

Enter 2 for sda2

Enter 15GB for the end of sda2 partition

quit

The last steps are to mount the partition and resize the btrfs file system:

0:rescue:~ # mount /dev/sda2 /mnt
0:rescue:~ # btrfs filesystem resize max /mnt
Resize '/mnt' of 'max'


0:rescue:~ # df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0       29M   29M     0 100% /parts/mp_0000
/dev/loop1       14M   14M     0 100% /parts/mp_0001
devtmpfs        468M     0  468M   0% /dev
/dev/loop2       42M   42M     0 100% /mounts/mp_0000
/dev/loop3       34M   34M     0 100% /mounts/mp_0001
/dev/loop4      4.2M  4.2M     0 100% /mounts/mp_0002
tmpfs           497M     0  497M   0% /dev/shm
tmpfs           497M  7.2M  490M   2% /run
tmpfs           497M     0  497M   0% /sys/fs/cgroup
tmpfs           497M     0  497M   0% /tmp
tmpfs           100M     0  100M   0% /run/user/0
/dev/sda2      14.3G    7G  7.3G  43% /mnt

Reboot the system back into operation.

shutdown -r -t 0

Reference:
https://www.novell.com/support/kb/doc.php?id=7018329

Posted in VirtualMachine | Tagged , | Leave a comment

SUSE Linux Enterprise 12 SP3 (SLES 12) Installation + Guest Additions on Oracle VirtualBox [2017]

SUSE Linux Enterprise 12 SP3 (SLES 12) Installation + Guest Additions on Oracle VirtualBox [2017]

https://www.youtube.com/watch?v=_n81N7Hihu4

After install SLES 12 SP2 make sure you have the SLES ISO Disk1 mounted.

Open a terminal window (by right click on desktop and Open terminal). Run:

whoami

sudo bash

cd

zypper in gcc kernel-default-devel

Now, exit the terminal window, and umount the SLES ISO disk.

Open a new terminal and run:

sudo bash

vi /etc/modprobe.d/10-unsupported-modules.conf

Edit the file and set

allow_unsupported_modules 1

and save

Mount the Oracle VirtualBox Guest Additions CD, and enter the root password in order to run the setup.

Restart the SLES.

At restart after log in, copy from clipboard a text from windows host into the Linux notepad

Open a new Terminal window and run the following to check that the vbox processes are running.

hostnamectl

systemctl status vboxadd*

ps -ef | grep -i vbox

Screenshots are attached for the record.

Posted in linux, VirtualMachine | Tagged , , | Leave a comment